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

How do you detect if someone teleported?

Asked by 6 years ago

Whats the basic idea of detecting if someone teleported his/her character

1 answer

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

I am fairly sure that GetPropertyChangedSignal only fires for the HumanoidRootPart position if they have been teleported, so you could try something like this:

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        local root = char:WaitForChild("HumanoidRootPart")
        root:GetPropertyChangedSignal("Position"):Connect(function()
            print(plr.Name .. " teleported")
        end)
    end)
end)

However, it is probably a better idea to make a module script with the code that you want to run when a player teleports, and require that module every time a player is teleported in a script.

Ad

Answer this question