Very strange bug with teleporters

I have a very strange bug in my game, for no reason people sometimes get teleported back to the teleporters when they touch random parts of my game without any type of connection

The code is nothing special, it also seems that it only happens to some

d = false

script.Parent.base.Touched:Connect(function(part)
	local HumanoidRootPart = part.Parent:FindFirstChild("HumanoidRootPart")
	if HumanoidRootPart then
		if d == false then
			d = true		
			owner = script.Parent.Parent.Parent.Parent.OwnerName
			if HumanoidRootPart.Parent.Name == owner.Value then
				HumanoidRootPart.Parent:PivotTo(workspace.ObbyTeleporter2.target.CFrame)
			end
			task.wait(2)
			d = false
		end
	end
end)

workspace.ObbyTeleporter2.base.Touched:Connect(function(part)
	local HumanoidRootPart = part.Parent:FindFirstChild("HumanoidRootPart")
	print(part)
	if HumanoidRootPart then
		if d == false then
			d = true
			if HumanoidRootPart.Parent.Name == owner.Value then
				HumanoidRootPart.Parent:PivotTo(script.Parent.target.CFrame)
			end
			task.wait(2)
			d = false
		end
	end
end)

1 Like

that print
print(part)
Was it because you were debugging and trying to find the source of the error?
if not, I recommend putting a print to trigger before the teleport so that you can detect the origin of the problem.

before the player teleports do you notice anything In the output log?

1 Like

yes i have been debugging and i didnt notice anything In the output log, It’s really something very strange

1 Like

Did you do what I recommended?

I told you to place the prints before the player is teleported so that. you can identify the ROOT of the problem. For all we know, it could be an entirely different script.

Are you sure it is that, and how? Were you able to verify?

If you didn’t notice anything in the output log you debug by adding prints to find things in the output log.

1 Like

ok thanks i think i resolved it with a different script