Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. local playername = game.Players.LocalPlayer.Name
  2. local player = game.Workspace:FindFirstChild(playername)
  3. local Mouse = player:GetMouse()
  4. local cancut = script.Parent:FindFirstChild("CanCut")
  5.  
  6. function onTouch(hit)
  7.     local cuttable = hit.Parent.Cuttable
  8.     if cuttable and hit.Parent then
  9.         if cuttable.Value == 1 and cancut.Value == 1 then
  10.             local treehp = hit.Parent.TreeHealth
  11.             local parts = hit.Parent:getChildren()
  12.             print("Hit a tree!")
  13.             script.Parent.CanCut.Value = 0
  14.             script.Parent.Parent.LogValue.Value = script.Parent.Parent.LogValue.Value + 1
  15.             treehp.Value = treehp.Value - 1
  16.                 if treehp.Value < 1 then
  17.                     hit.Parent.Parent = game.ServerStorage
  18.                 end
  19.                 wait(1)
  20.             cancut.Value = 1
  21.         end
  22.     end
  23. end
  24.  
  25. Mouse.Button1Down:connect(function(key)
  26.    
  27.     local s = player.Character.Humanoid:LoadAnimation(script.Parent:findFirstChild("HatchetCut"))
  28.     s:Play()
  29.     wait(1)
  30.     s:Stop()
  31. end)
  32. script.Parent.CutP4.Touched:connect(onTouch)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement