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

Help with a script changing a leader board int value?

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

✓ Accepted answer

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

7 comments

0

Ok well that definitely helps but i also need to make the function up the value by 1 for every click

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

0

i found "intvalue" in it but it doesnt say anything about how to make a script change one

0

and i did some research and found that page already but i still dont understand how to change the vaule around

0

You can use the assignment operator.. after you scope to the property. experience.Value = experience.Value + 1

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

0

nevermind i have it now thx for your help :P

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