My attempt at making a platform that goes back and forth is considered to be a failure. Is it okay to put a while loop in as while loop? This is my code:
while true do while true do script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,0,.5) wait() end script.Parent.BrickColor=BrickColor.new("Bright blue") wait(5) while true do script.Parent.CFrame=script.Parent.CFrame-Vector3.new(0,0,.5) wait() end script.Parent.BrickColor=BrickColor.new("Bright orange") wait(5) end
A script doesn't move on to the next section until the previous section has yielded. Your script is stuck on the first (nested) while loop. You can however, use coroutines to prevent this. Coroutines
Put these inside the main loop to replace the other "while " loops
coroutine.resume(coroutine.create(function() while wait() do --cframe stuff end end))