Script happening twice

local debounce = false
game.Workspace.Cutscenes.CutSc.Touched:Connect(function(hit)
	game.ReplicatedStorage.Entity.SeekStanding.Parent = game.Workspace
	wait(10.6)
	game.ReplicatedStorage.Entity.SeekMoving.Parent = game.Workspace
	game.Workspace.SeekStanding.Parent = game.ReplicatedStorage
	wait(38)
	game.Workspace.SeekMoving.Parent = game.ReplicatedStorage
	wait(10)
	game.ReplicatedStorage.SeekStanding.Parent = game.ReplicatedStorage.Entity
	game.ReplicatedStorage.SeekMoving.Parent = game.ReplicatedStorage.Entity
	task.wait(10) -- 1 second delay in between each event.
	debounce = false
end)

My script is this it happens multiple times when im trying to make a cutscene

1 Like

You arent actually checking if the debounce is taking place, so you could do this to check if it actually is in place:

-- Method 1:
if not debounce then -- if debounce is false (not active)
    debounce = true -- activates debounce
    -- code here
    debounce = false -- disables debounce
end

-- Method 2:
if debounce then return end -- ends function if debounce active
debounce = true -- activates debounce
-- code here
debounce = false -- disables debounce

You can also disable CanTouch to ensure it wont be touched again.