Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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.

0
Bruh User#34929 0 — 4y
0
fine i will answer your question DecalMaker2468 21 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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)
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. maxpax2009 340 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
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)

0
It does not work. User#34929 0 — 4y
0
-_-, you're supposed to move the humanoidrootpart maxpax2009 340 — 4y

Answer this question