script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local object = player.Character
local ls = player.leaderstats
local sl = game.Workspace:FindFirstChild(ls.Stage.Value)
object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0)
print(num) --shows that it repeats twice
num = num + 1
end)
✓ ANSWER ACCEPTED
I Don't Know Why This Script Repeats Twice?
1 answer
✓ Accepted answer
The Event you’re Connecting too is causing this issue, .Touched can fire multiple times in a few seconds, as simply moving will reenable the function once again, easy fix though, you just need to add a debounce, it would look somewhat like this compared to your Script.
local part = script.Parent
local touched = false
part.Touched:Connect(function(hit)
if touched then return end
if (hit) ~= nil) then
touched = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local character = player.Character or player.CharacterAdded:wait()
local leader = player.leaderstats
local stage = workspace:FindFirstChild(leader.Stage.Value)
Character:MoveTo(stage.CFrame).p + Vector3.new(0,3,0)
repeat
local parts part:GetTouchingParts()
if (parts == nil) then
touching = false
end
until not touching
end
end)
Hope this works out for you, I also switched up a few things for efficiency, if so don’t forget to accept the answer and upvote! Good luck!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
add a debounce, I noticed if I add a print, and touch the part, it prints over 100 times in 3 seconds.