cd = script.Parent.ClickDetector cd.MouseClick:connect(function() a = game.Workspace:GetChildren(Boat) for i,v in pairs(a) do if v.Name == "Part" then for i = 1, 1000 do v.CFrame = v.CFrame * CFrame.new(0,.5,-.2) wait(.01) v.CFrame = v.CFrame * CFrame.new(0,-.5,-.2) wait(.01) end end end end)
The script, OnClick, is supposed to make everything in/on the boat move to the left, and slightly move up and down. I've also tried this:
cd.MouseClick:connect(function() game.Workspace.Boat:GetChildren() for i,v in pairs() do for i = 1, 1000 do v.CFrame = v.CFrame * CFrame.new(0,0,-.2) wait(.01) end end end)
To the moderator note-- I will make sure to do that next time.
Well, looking at the script, everything isn't going to move in unison. In your 2nd for loop, you have two waits in there. That would delay the next part from moving by .02 seconds, and so forth. In other terms, it would basically look like a snake moving. If you want it to move in unison, I recommend creating another for loop with a wait between each for loop so it moves everything together. One other thing I noticed is, in your first for loop, you put Boat
. If you're trying to move the boat, you should put game.Workspace.Boat:GetChildren()
. I would've put this all as a comment, but it didn't fit. Hope these tips help you.
cd.MouseClick:connect(function() game.Workspace.Boat:GetChildren() for i,v in pairs() do for i = 1, 1000 do v.CFrame = v.CFrame * CFrame.new(0,0,-.2) end -- the wait would go here if you were to add something else. The above is moving everything in unison as you wanted. end end)