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

Checking Players Value ?? [ HELP]

Asked by
Altives 17
4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

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) Altives 17 — 4y
0
You would do TextLabel.Text <= 10480 Dan_PanMan 227 — 4y
0
yep thx it works Altives 17 — 4y
Ad

Answer this question