Choppable trees help

Hi! well I want to keep this post simple and clear so I’ll get straight to the point.

Well, for a few days I have been looking for information on how to make a system to cut down trees similar to what would be lumber tycoon 2 but I did not find anything, only some videos but very basic that did not serve me so if you have any documentation, module or idea where to start I would appreciate it!

Thanks in advance.
(yeah i know more or less the basics of scripting)

1 Like

I’m unfamiliar with Lumber Tycoon. Are you trying to simulate how wood is chopped in Minecraft?

No, more like the forest for example.

You hit the tree (with some tool I presume) in close proximity and it eventually chops down into several logs?

You could achieve this by creating a tree model, inserting a Humanoid instance into the tree, insert a script instance into the tree which contains a Touched event and checks if the part which fired the Touched event belongs to that of some tool of your choice (axe, hands etc.) this would then reduce the health of the tree (as set in the Humanoid instance of the tree model) and then once the health of the tree reaches 0 you could replace the tree model with a few logs which could then be either dropped onto the floor in the workspace or given to the user’s inventory.

Mh it can be a good solution but i refer more like when you hit the tree the log will cut into two pieces where u clicked the tree idk if u understand.

Thanks for giving a little more clarity, I’m aware of what you mean now, like in fruit ninja when you slice a fruit the fruit would be split according to how you sliced it.

1 Like

This is an answer given directly by Defaultio on a similar post

Use treePart.CFrame:pointToObjectSpace(mouseClickPos) and take the Y component of that vector (assuming your treePart is oriented so that Y is the tall axis) to get the height along the length of the part that the cut should be made.

Once you have the height the cut needs to made, delete the original tree part and replace it with two parts above and below the cut line, with adjusted Y sizes to make the cut work.

Rebuild the welds between the bottom and top part and their branches.

2 Likes

Thx! but idk if someone can leave like a more detailed version of what defaultio sayed.
but yeah thx

I’m not experienced with what he’s talking about but it appears he’s saying use “:pointToObjectSpace(mouseClickPos)” to get the exact Y axis cut position then delete the original tree part and create 2 parts on each side of the cut position to make it appear as if it’s been split into 2 parts

Info on :pointToObjectSpace() is here

Also you’d have to rebuild the welds so the parts don’t just fall off the tree but that shouldn’t be too hard

2 Likes