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

Why is TeleportService Not Working?

Asked by 4 years ago

I am currently trying to teleport my avatar into another place attached to my game. Here is the code I used for my Teleportation pad.

local TpService = game:GetService("TeleportService")

script.Parent.Touched:Connect(function(hit)
    local human = hit.Parent:FindFirstChild("Humanoid")
    if human ~= nil then
        local GuyWhoTouched = game.Players:GetPlayerFromCharacter(hit.Parent)
        TpService:Teleport(5616919371,GuyWhoTouched)
    end
end)

However, when I play the game and touch the part, the screen simply freezes, and the program stops responding. The code is in a server script, and the script's parent is the teleporter. I tested this on a live server instead of Studio, and both places are set to private. Is there something wrong with the script?

1 answer

Log in to vote
0
Answered by 4 years ago

try using a debounce lol

Ad

Answer this question