Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is wrong with this simple MoveTo() script? It doesn't move the player that joins.

Why does this code not do anything? There is no error.

game.Players.PlayerAdded:Connect(function(plr)
wait(3)
	plr.CharacterAdded:Wait()
	local Char = plr.Character
	local Hum = Char:WaitForChild("Humanoid")
	Hum:MoveTo(Vector3.new((workspace.Tel.Position)))
	print("Moved player.")
end)

Thanks in advance.

3 comments

0

Bruh

0

fine i will answer your question

2 answers

✓ Accepted answer

I don't understand all the new Humanoid Root Part. But I use MoveTo all the time when I move players. (I don't frequently do but when I move them MoveTo works.) It can be very useful, but also can mess up depending on where the part you are moving to is located.

game.Players.PlayerAdded:Connect(function(plr)
wait(3)
    game.Workspace:FindFirstChild(plr.Name) -- up here you had a different method for getting the chracter. That was making you wait forever. 
    local Char = plr.Character
    local Hum = Char:WaitForChild("Humanoid")
    Char:MoveTo(game.Workspace.Tel.Position) --- very close. Just don't use vector3.new and you can't use MoveTo on a humanoid. It can only be used on a Model. So use it on the character
    print("Moved player.")
end)

1 comment

0

I don't recommend moving the player, it commonly causes in-game bugs and other consequences, I'd stick to moving the HumanoidRootPart because it's the PrimaryCFrame of the player.

game.Players.PlayerAdded:Connect(function(plr)
wait(3)
   plr.CharacterAdded:Wait()
	    local Char = plr.Character
	    Char:WaitForChild("HumanoidRootPart").Position = workspace.Tel.CFrame
	    print("Moved player.")
	end)

2 comments

0

It does not work.

0

-_-, you're supposed to move the humanoidrootpart

This discussion is preserved as it was. New answers, comments, and votes are closed.