Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Search for a model called "Tree_start"
- local Tree_found = game.Workspace:FindFirstChild("Tree_start")
- --if the tree is cloned, do this
- if Tree_found then
- --Shorten the location
- Cloned_tree = game.Workspace.Tree_start
- --Initialize the cursor
- local mouse = game.Players.LocalPlayer:GetMouse()
- --Execute when hovering over tree
- Cloned_tree.branch.ClickDetector.MouseHoverEnter:connect(function(player)
- mouse.Icon = "rbxassetid://652411591"
- end)
- --Execute when the hovering stops
- Cloned_tree.branch.ClickDetector.MouseHoverLeave:connect(function(player)
- mouse.Icon = "rbxassetid://652178724"
- end)
- --adds a button functionality to the branch
- Cloned_tree.branch.ClickDetector.MouseClick:connect(function()
- --sound effect (1 and 2)
- local SoundEffect_tree = math.random(1, 2)
- --play Chop1
- if(SoundEffect_tree == 1) then
- print("Playing: Chop1")
- Cloned_tree.chop1:Play()
- end
- --play Chop2
- if(SoundEffect_tree == 2) then
- print("Playing: Chop2")
- Cloned_tree.chop2:Play()
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment