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

Checking Players Value ?? [ HELP]

So Im making a game on Roblox and wonder how i could check if a player has a certain amount

so basically how would i check if a player has like : 10.48k strength

Note the : 10.48k strength wont be 10480 Hopefully someone get what i actually mean and something like if value == 10.48k wont work and stuck at this will appreciate any help i can get

1 answer

✓ Accepted answer

In a local script in StarterPlayerScripts, you can do

local stat = "Strength" -- Define a variable with the stat name
if script.Parent.leaderstats[stat].Value >= 10480 then -- Checks if user has at least 10480 
	print("Player has 10480 "..stat..".") -- Whatever you want it to do
elseif script.Parent.leaderstats[stat].Value <= 10480 then -- Checks if user has less than 10480
	print("Player has less than 10480 "..stat..".") -- Whatever you want it to do
end

This should help you, good luck with whatever you are doing :)

~ Dan_PanMan, advanced scripter.

3 comments

0

What if its a text label and the text is something like this : 1.341k (what would i do to check that i don't wanna use value for it yk)

0

You would do TextLabel.Text <= 10480

0

yep thx it works

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