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

Teleporting player script not working? [FIXED WITH :SetPrimaryPartCFrame()]

Asked by 6 years ago
Edited 6 years ago
script.Parent.Touched:connect(function(hit)
    local hum = hit.Parent:FindFirstChild("HumanoidRootPart")
    if hum then
        local char = hum.Parent
        char:MoveTo(Vector3.new(-42.977, -60.63, -4.636))
    end
end)

The script does teleport the player but to the wrong spot. It might have to do with the amount of space the position has. I tried printing the position and it said "nil". How would you fix this?

0
why don't you use char.Position = Vector3.new(-42.977, -60.63, -4.636)? or better yet CFrames! C: Worthy0ne 68 — 6y
0
char is the model the character is and I am unfamiliar with CFrames. InfernoExeuctioner 126 — 6y
0
I used :SetPrimaryPartCFrame() and it worked thanks InfernoExeuctioner 126 — 6y

Answer this question