I am making a game which requires you to hit rocks with you tool in order to obtain rocks to sell. I need to know how I could make it where:
1: You need to pull out your tool in order to hit the rock, if you do not have your tool out it will not work.
2: When you click the rock with tool in hand, it will give you a rock (already have the leaderstat set up)
All help is appreciated!
`function onClicked() player.leaderstats.Your stats name.Value = player.leaderstats.Your stats name.Value + 1 script.parent.Parent:Destroy() end script.Parent.ClickDetector.MouseClick:connect(onClicked)`
Replace the parts that say Your stats name to the name of the stats you want it to increase and this only works if you dont have an item since im not sure how to make it like that (Edit: If you dont want it to disappear after you click it use this script)
function onClicked() player.leaderstats.Your stats name.Value = player.leaderstats.Your stats name.Value + 1 script.parent.Parent:Destroy() end