【发布时间】:2021-09-04 14:17:38
【问题描述】:
所以我试图让循环每秒更改数值的值,但它会不断返回nil 或0。我尝试将其添加为影响实际值的本地值以及其他一些事情,例如将其改为字符串并用新字符串替换字符串,但仍然没有返回任何内容。这是我现在的代码,它是返回 0 而不是 nil 或错误的代码。
local SecondsAfterGameStart = game.ServerStorage.SecondsAfterGameStart.Value
while true do
wait(0.1)
SecondsAfterGameStart = SecondsAfterGameStart + 1
end
【问题讨论】:
-
您是否尝试在其父级上使用 WaitForChild,然后在其自身上使用?另外,获取ServerStorage的方法是使用GetService来获取实例。查看此帖子developer.roblox.com/en-us/api-reference/class/ServerStorage
-
是的,waitforchild 没有工作