trying to make a tree that when you interact with it it falls over and gives you a tool that you can sell for money.
The first time you cut down the “Tree”, it falls over perfectly. But the second time it launches itself in the air…
Here is all the code.
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
trunk:ApplyImpulse(Vector3.new(x,y,300))
trunk.ProximityPrompt.Enabled = false
wait(2)
trunk.Transparency = 1
trunk.CanCollide = false
wait(1)
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)
Thanks for any help!