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)