Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will this loop not check this value? (server script)

Asked by
chafava -113
5 years ago
local path = script.Parent.SaveObject.Value

while true do
if script.Parent.WreckTree.Value == "true" then
    print("comon")
    path:Destroy()
end
wait(0.1)
end

If value is true it prints comon and destroys the path (saveobject = game.Workspace.Tree) and wont work and wont print, why not?

0
is WreckTree a BoolValue? danglt 185 — 5y
1
in true get rid of the speech marks, if its a bool value NSMascot 113 — 5y
1
Also, I think when you destroy the object, you need to have the path variable equal to the object not the value (I have not tested anything). zblox164 531 — 5y
0
If SaveObject is a value type, then that's true Lazarix9 245 — 5y

1 answer

Log in to vote
3
Answered by
NSMascot 113
5 years ago

in true get rid of the speech marks, if its a bool value, your code will look like this

local path = script.Parent.SaveObject.Value

while true do
if script.Parent.WreckTree.Value == true then
    print("comon")
    path:Destroy()
end
wait(0.1)
end
Ad

Answer this question