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

How do I use a equal to or greater then statement?

Asked by
NecoBoss 194
10 years ago

Okay so I am trying to make a statement that says: if leaderstats is greater than or equal to 100 then How would I put that into scripting language?

2 answers

Log in to vote
2
Answered by
Ekkoh 635 Moderation Voter
10 years ago

Depends on what leaderstat you're checking. To access a leaderstat-

Game.Players.PlayerName.leaderstats.StatName

so...

if Game.Players.PlayerName.leaderstats.StatName.Value >= 100 then
    print("dewd u r rich")
end
Ad
Log in to vote
2
Answered by
User#2 0
10 years ago

You would do exactly what you're saying, use the >= operator in an if statement.

local SomeNumber = 1337
local SomeOtherNumber = 9001
local TheLastNumber = 42

if SomeNumber >= 1337 then
    print("Some Number is at least 1337")
end
if SomeOtherNumber >= 1337 then
    print("Some Other Number is at least 1337")
end
if TheLastNumber >= 1337 then
    print("The Last Number is at least 1337")
end

--- Output:
-- Some Number is at least 1337
-- Some Other Number is at least 1337

For the leaderstats part, you do that however you would like, there is no definite way and a broad amount of solutions to answer such a question with such a lack of detail.

Answer this question