Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 1 year ago

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!

0
I only know how to make it so if you click cbeebiespoo -5 — 1y
0
without an item cbeebiespoo -5 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago
`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 
Ad

Answer this question