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

Help with a script changing a leader board int value?

Asked by 7 years ago

I have a script that detects when you left click only while holding a specific tool but i need it to change the int value of a leader board stat every time you click

Here is my script so far

local Tool = script.Parent --make sure this is a Tool object

Tool.Equipped:connect(function(Mouse)
    Mouse.Button1Down:connect(function()

    end)
end)

Any help would be appreciated :P

1 answer

Log in to vote
0
Answered by 7 years ago

Just like you referenced your tool variable. Create a reference to your IntValue object.

For example if you had your leaderstats parent as the player and you had an IntValue object with the name (identifier) as "experience" with it's parent being leaderstats. You could use something like this.

local player = game.Players.LocalPlayer
local leaderstats = player:FindFirstChild("leaderstats")
local experience = leaderstats.experience
0
Ok well that definitely helps but i also need to make the function up the value by 1 for every click sora10056 20 — 7y
0
Please use the Roblox API. If you did some research the IntValue object has a Value property to read/write to. http://wiki.roblox.com/index.php?title=API:Class/IntValue/Value Impacthills 223 — 7y
0
i found "intvalue" in it but it doesnt say anything about how to make a script change one sora10056 20 — 7y
0
and i did some research and found that page already but i still dont understand how to change the vaule around sora10056 20 — 7y
View all comments (3 more)
0
You can use the assignment operator.. after you scope to the property. experience.Value = experience.Value + 1 Impacthills 223 — 7y
0
I'm sorry if I seem uneducated in the subject but it's because I'm very new to lua scripting and this is my first crack at it so if it isn't too much to ask could you try to give me a easier to understand explanation sora10056 20 — 7y
0
nevermind i have it now thx for your help :P sora10056 20 — 7y
Ad

Answer this question