Wait() stops my script for no reason

trying to make a tree fall over and come back after its chopped down it works if i delete a certain wait() but if i include it it stops working! any solutions?

script.Parent.Triggered:Connect(function(Player, plr)
	local trunk = script.Parent.Parent
	local logclo = game.ServerStorage.Log:Clone()
	logclo.Parent = Player.Backpack
	local originPos = trunk.Position
	local originOri = trunk.Orientation
	print(originOri, originPos)
	trunk.Anchored = false
	wait(0.1)
	trunk:ApplyImpulse(Vector3.new(x,y,300))
	trunk.ProximityPrompt.Enabled = false
	wait(2)
	print("bye bye tree")
	trunk.Transparency = 1
	trunk.CanCollide = false
	wait(5) -- gets to here and breaks
	print("Reloading tree")
	trunk.CanCollide = true
	trunk.Orientation = originOri
	trunk.Position = originPos
	trunk.Anchored = true
	trunk.Transparency = 0
	trunk.ProximityPrompt.Enabled = true
	print(trunk.Orientation, trunk.Position)
end)

Here is my code. Any help appreciated

the third wait(), there is a comment next to it. Line 16.

issue was it fell thru the world and got deleted… my bad lol
fixed it by anchoring it before it gets cancollide = false

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.