Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local playername = game.Players.LocalPlayer.Name
- local player = game.Workspace:FindFirstChild(playername)
- local Mouse = player:GetMouse()
- local cancut = script.Parent:FindFirstChild("CanCut")
- function onTouch(hit)
- local cuttable = hit.Parent.Cuttable
- if cuttable and hit.Parent then
- if cuttable.Value == 1 and cancut.Value == 1 then
- local treehp = hit.Parent.TreeHealth
- local parts = hit.Parent:getChildren()
- print("Hit a tree!")
- script.Parent.CanCut.Value = 0
- script.Parent.Parent.LogValue.Value = script.Parent.Parent.LogValue.Value + 1
- treehp.Value = treehp.Value - 1
- if treehp.Value < 1 then
- hit.Parent.Parent = game.ServerStorage
- end
- wait(1)
- cancut.Value = 1
- end
- end
- end
- Mouse.Button1Down:connect(function(key)
- local s = player.Character.Humanoid:LoadAnimation(script.Parent:findFirstChild("HatchetCut"))
- s:Play()
- wait(1)
- s:Stop()
- end)
- script.Parent.CutP4.Touched:connect(onTouch)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement