Teleporters teleporting player when touching any unanchored part after tping

  1. What do you want to achieve? I want a working teleport script that teleports you to the part its paired with, so you can teleport back and forth between them

  2. What is the issue? I’m able to teleport back and forth between the tpers, but immediately after teleporting if I touch any unanchored part in a certain timeframe (im not sure why) I teleport back to the teleporter i came back from

  3. What solutions have you tried so far? increasing debounce time, lowering debounce time, checking for scripts inside unanchored parts (but it seems to work for all of them

heres the script of one of the teleporters.
the teleporter its paired with has the exact same script but the Teleport variable at the top is changed.

local Teleport = "Teleport2" 	
				
script.Parent.Touched:connect(function(hit)
	
	local humanoid = hit.Parent:FindFirstChild("Humanoid")

	if humanoid then

		if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then
			script.Parent.Locked = true 
			
			script.Parent.Parent:findFirstChild(Teleport).Locked = true

			local Pos = script.Parent.Parent:findFirstChild(Teleport)
			hit.Parent:moveTo(Pos.Position) 
			task.wait(1) 
			script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false 
		end 
	end 
	
end) 

example video of the problem.
note: the part i touched that teleported me back was a random unanchored part i just created

Maybe disable the script for a certain amount of time (then re-enabling it). Honestly I don’t know what could be causing that bug. Lemme know if disabling the script worked for you.

nope it didnt work, but im just gonna remake the entire teleport script and see how it goes

1 Like

Alright well good luck with that :+1:

1 Like

soo for some reason this code works

local nametp2 = "Teleport2"
local TeleportPart2 = script.Parent.Parent:WaitForChild(nametp2)
local TeleportPart1 = script.Parent


TeleportPart1.Touched:Connect(function(hit)
	local hrp = hit.Parent:FindFirstChild("HumanoidRootPart")
	if hrp then
		hrp.CFrame = TeleportPart2.CFrame + Vector3.new(0, 5, 0)
		TeleportPart2.CanTouch = false
		task.wait(1)
		TeleportPart2.CanTouch = true
	end
end)

idk i dont even get why it does, but whatever i dont have the problem anymore
for the off chance someone else runs into this here it is.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.