I made a teleporter script and it works fine, until it doesn't. After a certain amount of uses it just stops working, and I can't figure out why. Any help?
The script »
local trigger = script.Parent.Parent.trigger
local destination = script.Parent.Parent.destination
local debounce = false
function onTouched(other)
if debounce == false then
debounce = true
local rootPart = other.Parent:FindFirstChild("HumanoidRootPart")
if rootPart ~= nil then
--local changeBy = {trigger.Position.X - destination.Position.X, trigger.Position.Y - destination.Position.Y, trigger.Position.Z - destination.Position.Z}
--rootPart.CFrame -= Vector3.new(changeBy[1],changeBy[2],changeBy[3])
rootPart.CFrame = CFrame.new(destination.Position.X, destination.Position.Y, destination.Position.z)
wait(1)
debounce = false
end
end
end
script.Parent.Touched:Connect(onTouched)
