Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a choppable tree in ROBLOX STUDIO??

Asked by 6 years ago

How can I make a choppable tree in ROBLOX STUDIO?? Like when we click and then it chop liie Lumber Tycoon 2. Thanks!

1
I just want to ask how to make it, not request a site?? rolocchannel2911 -14 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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

script.Parent.Blade.Touched:connect(hit)
    if hit.Parent.Name == "Tree" then
        hit.Parent.Health.Value = hit.Parent.Health.Value - 1
    end
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.

Ad

Answer this question