Teleport script only fires once

I have a script that teleports you to a little room under the map, but it only fires once, any reason why?

local block = script.Parent
local destination = game.Workspace["Bingus jail"]["TP point"].Position
local debounce = false

block.Touched:Connect(function(hit)
	if debounce then return end
		debounce = true
	hit.Parent.HumanoidRootPart.Position = destination
	debounce = false
end)

Oh, turns out it was my debounce that broke it, sorry

What happens if you get rid of the debounce, the way you have it set up doesn’t really do anything anyways, also add a check to make sure it’s a character that hits the block so there are no errors.

EDIT: Lol my response took to long and you did what I said to do anyways

1 Like

Yeah, I noticed the errors, and yes it was the debounce. I’ll try and see what I can do about the errors.

May I ask how exactly I do this? All I can think of is checking that hit.Parent is = to the player’s rootpart, but I don’t know exactly how to do that lol

Make your script this:


local block = script.Parent
local destination = game.Workspace["Bingus jail"]["TP point"].Position

block.Touched:Connect(function(hit)
	if not game.Players:GetPlayerFromCharacter(hit.Parent) then return end
	hit.Parent.HumanoidRootPart.Position = destination
end)
1 Like

I think I found a different method, but thanks anyway

(and sorry for wasting your time again)