I have attempted to get the result with negating parts and voxel models with no luck. And obviously with negating parts, physics don’t apply to parts that have been cut in half.
Just asking if anyone could point me out to the right direction, it would be greatly appreciated.
Okay this sounds confusing but I’ll try my best to help. You could try keeping track of the times they click on the tree and every time they click 1 part disappears.
For example, lets say you wanted a tree to fall after 5 times of clicking/chopping on it. You would have 5 different parts that look like it’s being chopped. So the first part would look slightly damaged, then the second part would look more damaged, etc. Then if it’s their first time clicking the tree, then make the first stage/part visible and the rest not visible, then the second part visible and not the rest, then the third. Once there are no more stages or parts, then make the tree fall.
You could have a Int or Number value inside of the tree and every time you click the tree it goes down by 1. Then if it reaches 0, un anchor the top part of the tree and maybe even give it a very very small force to make it tip over.
Here is a script with comments to let you know what everything does:
local clickDetector = script.Parent -- Get the Click Detector
local tree = script.Parent.Parent.Parent -- Get the Tree
local stages = tree.ChoppingStages -- Get the Stages Folder
local leaves = tree.Leaves -- Get the Leaves
local upperWood = tree.UpperWood -- Get the Upper Wood
local stageValue = tree.Stage -- Get the Stage Value
clickDetector.MouseClick:Connect(function(player) -- Once a player clicks the click detector
stageValue.Value += 1 -- Increase the Stage Value by 1
if stageValue.Value >= 4 then -- Since there are 3 stages, if we are above 3 stages...
for i, v in pairs(stages:GetChildren()) do -- Loop through everything in the Stages Folder
v.Transparency = 1 -- Set the part to be invisible
end
upperWood.Anchored = false -- Un anchor the upper part of the tree
upperWood.Velocity = Vector3.new(10, 0, 10) -- Give it a small velocity for a split second to make it fall
leaves:Destroy() -- Destroy the Leaves
else
for i, v in pairs(stages:GetChildren()) do -- Loop through everything in the Stages Folder
v.Transparency = 1 -- Set the part to be invisible
end
if stageValue.Value == 1 then -- If we are at the first stage...
stages.Stage1.Transparency = 0 -- Make the first stage part to visible
end
if stageValue.Value == 2 then -- If we are at the second stage...
stages.Stage2.Transparency = 0 -- Make the second stage part to visible
end
if stageValue.Value == 3 then -- If we are at the third stage...
stages.Stage3.Transparency = 0 -- Make the third stage part to visible
end
end
end)