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

Adding numbers to leaderstats when we click on the Tool?

Asked by 4 years ago

hello When we click on a Tool, we will increase the number of leaderstats for example:

game.workspace.Tool.activated:connect(function()

game.players.localplayer.leaderstats.Subs...???

end)

0
Where is the question? IStarConquestI 414 — 4y
0
Subscribers will increase by 1 when we click kingkemalll -4 — 4y
0
Ah yes, I know exactly what you are asking now. IStarConquestI 414 — 4y
0
Do you mean click on a Gui? Just click the mouse when the tool is selected? Explain in more depth or we can't help you. darkelementallord 686 — 4y
0
I'm trying to say that when you click on a vehicle, subs will increase by 1 kingkemalll -4 — 4y

1 answer

Log in to vote
0
Answered by
Nckripted 580 Moderation Voter
4 years ago

This is actually a simple script that is commonly used. Do this:

local Players = game:GetService("Players")

script.Parent.Activated:Connect(function()
    local player = Players:GetPlayerFromCharacter()
    if player then
        player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 1
    end
end)
Ad

Answer this question