Hiya, getting back into development here, so excuse my extra stupidity
Anyway, I’m working on a tree chopping mechanic and I’m currently figuring out a way to respawn trees once they have been chopped. So I came up with an idea that does techniqually work, however I want to see what you guys think.
When the health of the tree reaches 0, a BindableEvent is fired and then the tree is sent to a folder in ServerStorage. Then, the health of the tree is set back to its original value and then after a set amount of time, it is sent back to the workspace. Thoughts?
I think this is good so far, nothing to worry about. For ‘realism’ though, maybe don’t have the tree instantly disappear (only if it does, I can’t really tell) once it’s chopped.
Also are you using metatables? Might be of interest when you want to add more data and functions to your trees.
Yes, the tree does instantly disappear. Not too good at effects and aesthetics.
And no, I don’t use metatables. It’s just a folder in the tree with IntValues. But I’ll be sure to look in to that because I do the same thing for the axe too. I think overtime it will become to cluttered so I’ll be sure to look into it. Thanks!
I wouldn’t use Rg3 simply because Roblox deprecated it for performance reasons. You can just make a box with 4 points. I would use a metastable object to define a region and simply call a method to do some logic to spawn a tree. I wrote a system similar to this in an uncopylocked game I made a while back.
The code in this isn’t the best but the concept applies.
I also wrote multiple articles on the forums regarding OOP in LUA. I would suggest taking those a look as well as viewing my youtube. I mostly code using the OOP paradigm, its not good in all scenarios but in this one it is.