Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Created by xmaanzach
- local Tronco = script.Parent.Tronco
- local Model = script.Parent
- local Backup = Model:Clone()
- local leaves = {}
- local Regenerar = true
- local RegenCooldown = 3
- local debounce = false
- local fall = false
- local ToolName = "Hacha"
- local Currency = "Madera"
- local Amount = 100
- for _, child in pairs(script.Parent:GetChildren())do
- if child ~= script and child ~= Tronco and child:IsA("UnionOperation") or child:IsA("Part") then
- table.insert(leaves, child)
- end
- end
- local function DestroyLeaves()
- for hoja = 1, #leaves do
- leaves[hoja].Anchored = false
- leaves[hoja].CanCollide = false
- Tronco.Transparency = 1
- fall = true
- end
- end
- Tronco.Touched:Connect(function(hit)
- if hit.Parent.Name == ToolName then
- if not debounce and not fall then
- debounce = true
- local Player = game.Players:GetPlayerFromCharacter(hit.Parent.Parent)
- local leader = Player.leaderstats:FindFirstChild(Currency)
- leader.Value = leader.Value + Amount
- DestroyLeaves()
- end
- end
- wait(3)
- debounce = false
- end)
- while wait() do
- if fall then
- wait(0.5)
- Model:Destroy()
- if fall and Regenerar then
- wait(RegenCooldown)
- Backup.Parent = workspace
- Backup:MakeJoints()
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement