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

teleport player to a located working fine in studio but not in roblox player anyone know what to do?

Asked by 6 years ago

I have a teleport script inside of a regular script inside of a part. It works fine in studio but in the roblox player. Anyone know a solution?

script.Parent.Parent.touch1.Touched:Connect(function()
    local player = workspace:FindFirstChild(game.Players.LocalPlayer.Name)
    wait(.5)
    player.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(176.303, 1.5, -21.643))
end)
0
is that in a local script or a server script? because LocalPlayer can only be used in local scripts CrazyRoblots 13 — 6y

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

You should get the character from the Touched argument if it’s in a normal script:

script.Parent.Parent.touch1.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("HumanoidRootPart") then
        wait(0.5)
        hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(176.303, 1.5, -21.643))
    end
end)
Ad

Answer this question