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

how to trigger a script from a part while a player is sitting?

Asked by 4 years ago

hi, i have a issue. while my character is sitting while the object that is moving it to the part that triggers a script, but the problem is, it doesnt trigger a script. it just stays empty. no errors or something like that. heres the scripts for the moving part that is supposed to teleport the player:

script.Parent.Touched:Connect(function(hit)
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
    if hit.parent:FindFirstChild("Humanoid") then
local code = TS:ReserveServer(4385878460) -- Returns a code
local player = Players:FindFirstChild(hit.Parent.Name)-- Get a list of all players

TS:TeleportToPrivateServer(4385878460,code,{player}) -- Actually teleport the players
    end
end)

Answer this question