I have a script to make a block move forward continuously. It works just fine. But I wanted to make a main menu with a play button. So therefor I had to make it so the block would start moving after the player pressed the button Play. I tried to script it but couldn't figure it out. Can someone help? Here is the script ~~~~~~~~~~~~~~~~~
game.StarterGui.ScreenGui.Frame.Play.MouseButton1Down:connect(function() wait(7) local distance = 20000 script.Parent.Anchored = true for i = 0, distance do end script.Parent.CFrame = script.Parent.CFrame+Vector3.new(2.1,0,0) wait(0.1)
end)
~~~~~~~~~~~~~~~~~
From the looks of it, you accidentally moved line 10 and 11 outside of the for loop, so adding those back in should fix it:
game.StarterGui.ScreenGui.Frame.Play.MouseButton1Down:connect(function() wait(7) local distance = 20000 script.Parent.Anchored = true for i = 0, distance do script.Parent.CFrame = script.Parent.CFrame+Vector3.new(2.1,0,0) wait(0.1) end end)
No shame in this though. It happens to the best of us!