Guest User

Untitled

a guest
Feb 12th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. --Search for a model called "Tree_start"
  2. local Tree_found = game.Workspace:FindFirstChild("Tree_start")
  3.  
  4. --if the tree is cloned, do this
  5. if Tree_found then
  6.  
  7. --Shorten the location
  8. Cloned_tree = game.Workspace.Tree_start
  9.  
  10. --Initialize the cursor
  11. local mouse = game.Players.LocalPlayer:GetMouse()
  12.  
  13. --Execute when hovering over tree
  14. Cloned_tree.branch.ClickDetector.MouseHoverEnter:connect(function(player)
  15. mouse.Icon = "rbxassetid://652411591"
  16. end)
  17.  
  18. --Execute when the hovering stops
  19. Cloned_tree.branch.ClickDetector.MouseHoverLeave:connect(function(player)
  20. mouse.Icon = "rbxassetid://652178724"
  21. end)
  22.  
  23. --adds a button functionality to the branch
  24. Cloned_tree.branch.ClickDetector.MouseClick:connect(function()
  25.  
  26. --sound effect (1 and 2)
  27. local SoundEffect_tree = math.random(1, 2)
  28.  
  29. --play Chop1
  30. if(SoundEffect_tree == 1) then
  31. print("Playing: Chop1")
  32. Cloned_tree.chop1:Play()
  33. end
  34.  
  35. --play Chop2
  36. if(SoundEffect_tree == 2) then
  37. print("Playing: Chop2")
  38. Cloned_tree.chop2:Play()
  39. end
  40. end)
  41. end
Advertisement
Add Comment
Please, Sign In to add comment