Whenever you touch a part -
-- SERVER SCRIPT
local debounce = false
script.Parent.Touched:connect(function(hit)
if not debounce and game.Players:GetPlayerFromCharacter(hit.Parent) then
print('touched') -- this prints once and only once.
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
debounce = true
game:GetService("TeleportService"):Teleport(99257569, plr)
end
end)
Whenever the tool is 'activated'
-- LOCAL SCRIPT
local teleport = false
Tool.Activated:connect(function()
if Hum and Hum.Parent.Name == "Chancellor" and not teleport then
teleport = true
plr.PlayerGui.MessasgeGui.Frame.Visible = true
spawn(function()
Tool.DamageEvent:FireServer(Hum,HitPart,HitPos)
wait(5)
plr.PlayerGui.MessasgeGui.Frame.Yes.Visible = true
wait(5)
print('fired teleport service') -- this prints once and only once.
game:GetService("TeleportService"):Teleport(83536360)
end)
end)
