game.Players.PlayerAdded:Connect(function() repeat wait(1.5) local clm = game.Workspace.Noob:Clone() clm.Parent = game.Workspace local cl = clm.Torso cl:MoveTo(65,24,-19) --65,24,-19 until script.Disabled == true end)
This is for a tycoon-type game, and it should not stop the loop.
Please include whether an error has occurred or not rather than saying it didn't work.
To answer your question, the script only triggers once because the code inside the loop "errors" causing the script to terminate.
The MoveTo()
method is limited to Model
or Humanoid
types. To fix this, you can either use CFrame to move the model -- or you could use clm
as the model and move it as well.
Also, MoveTo()
's first parameter is a Vector3
type. Not providing it will result in another error.
-- example using MoveTo() local clm = workspace.Noob:Clone() -- clm is a model clm.Parent = workspace clm:MoveTo(Vector3.new(65, 24, -19)) -- thus, we can use :MoveTo() -- example using CFrame local clm = workspace.Noob:Clone() clm.Parent = workspace local cl = clm.Torso -- since Torso is a BasePart, we can set a CFrame to it cl.CFrame = CFrame.new(Vector3.new(65, 24, -19))
I would also advise you to use a while loop if you don't intend to terminate the loop. Disabling scripts can cause some unintentional behaviors.