Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make it so if you equip a tool and click a part you receive a +1 leaderstat?

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!

2 comments

0

I only know how to make it so if you click

0

without an item

1 answer

`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 

This discussion is preserved as it was. New answers, comments, and votes are closed.