How can I make a choppable tree in ROBLOX STUDIO?? Like when we click and then it chop liie Lumber Tycoon 2. Thanks!
Well I dont exactly know how if you would want it to have an animation or anything when falling over.
But Ill give you a basic over view of how you may do this although I am not going to write the code :) That is your part, how will you learn if I just hand it to you.
Youll need a tree model and a tool. Inside the tool youll have all the basic scripting for the tool like damage and swing animations.
Inside the damage portion of the tools script you could use this code
1 | script.Parent.Blade.Touched:connect(hit) |
2 | if hit.Parent.Name = = "Tree" then |
3 | hit.Parent.Health.Value = hit.Parent.Health.Value - 1 |
4 | end |
5 | end |
This line of code is assuming your tool has a blade. It also assumes you named the tree model "Tree" if what you hit is a tree then it runs the damage line. The damage line assumes that you have a IntValue inside the tree model the intvalue would be called Health. It takes away 1 health from the tree for every hit. This isnt including a debounce so it could run many times infact it probably would.
You'd then have a break joints portion and the tree would fall apart if the Health.Value = 0
But thats just the extreme basics of how it would run.
Infact coding a tree is very basic stuff I am sure you could learn it :)
Have a nice day!
-- Sorry if this doesnt help. I dont wanna give you the entire answer I just wanna basically guide you to your answer. I know how it feels to be learning scripting, its super confusing but everyone can learn and once you do its awesome.