Tween object help

I made a script make a tree fall over with tweening, but it is not so working. Is there a way to tween a tree so it falls to the ground the oposite side the tool that you are holding? Here is the script i made:

local goal = {CFrame = script.Parent.CFrame * (CFrame.new(1,1,1) * CFrame.Angles(math.rad(75),0,0))}
local tweenlog = Tween:Create(tree.Tree,tweenInfo,goal)

what the tree usualy does:

what it does some of the time: 25sec

can anyone help?


anyone?


For some reason, your first video with the problem freezes at 1 second, so forgive me if I don’t understand something.

If I understand correctly, you want the tree to fall exactly in the opposite direction from the place where you cut it.
I’m assuming script.Parent is the tree itself.

To make it fall in the opposite direction, first you could make the tree look at your character, and then make it fall:

local tree = tree.Tree
local rootPos=CHARACTERHUMANOIDROOTPART.Position*Vector3.new(1,0,1)
rootPos += tree.Position*Vector3.new(0,1,0)

tree.CFrame = CFrame.new(tree.Position,rootPos) -- makes tree look at your character

local goal = {CFrame = tree.CFrame * (CFrame.new(1,1,1) * CFrame.Angles(math.rad(75),0,0))}
local tweenlog = Tween:Create(tree,tweenInfo,goal)

sadly, it does not work and script.Parent is the tool that the player is holding.

What does it say in the output? Any error messages appearing?

No errors, the code is fine it is just the tweening not working idk how to fix it.

1 Like

Try this:

local goal = {}
goal.CFrame = script.Parent.CFrame * (CFrame.new(1,1,1) * CFrame.Angles(math.rad(75),0,0))
local tweenlog = Tween:Create(tree.Tree,tweenInfo,goal)

It still does not work… Is there a way to move it down?
image

1 Like

Like you want it to fall over when the player chops it?

well it does the tween when the player is doen choping it, and i want it to fall over

Why don’t you unanchor it when the player chops it?

That way it’ll fall over.

is there a way to apply a force to it so it falls over?

I don’t think so.

But there’s a solution you can use. You can make a Part and make its size the same as the tree size. And position it to the location you want the tree to fall over on. And make it invisible and uncollidable. Then use this script

local FallPart = --Locate the Part here
local goal = {}
goal.CFrame = FallPart.CFrame
local tweenlog = Tween:Create(tree.Tree,tweenInfo,goal)

If this code didn’t work, then I’m out of ideas.

ill will stick with the unachored!

1 Like

Alright! Hope it works for you:)

Is ther a way to get the old pos of the tree and then after its fallen over it goes back to its orginal state?

1 Like

What do you exactly mean by ‘state’? Like position?

I’ll assume that you mean position

Yes, there is. Just create a variable, and store the old position of the tree inside it. Like this

local oldPos = Vector3.new(--Write the old position of the tree before it falls over)

And when it falls down, you can make it go back to its original state(Position) by saying:

task.wait(--Put the number of seconds that the tree will take to go back to its original state)
Tree.Position = oldPos
Tree.Anchored = true -- So it doesn't fall again when it gets back to its normal position

Does everything make sense?

1 Like

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