So what happens is, my brick moves every 10 seconds and only by a little bit. It seems like it skips the FOR loop and goes right ahead instead of finishing the function. I dont know whats going on and i need help, please :)
while true do wait(10) if game.Workspace.MainScript.Open == true then for i = 0, 55 do wait() script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 0.5) end end end
You need to index the Value
property of ValueObjects to reference it's value! You did not do so on line 3.
--You can just add the wait function in the definition of the while loop while wait(10) do --Index 'Value'. '== true' is redundant. if workspace.MainScript.Open.Value then for i = 0, 55 do wait() script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 0.5) end end end
I believe that it's skipping because ".Open" is not a proper property of a script. If not, maybe it's because the Vector3 portion isn't using "i", so it won't move with the for loop. Anyway, I hope you find the answer!