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

Possible to select a array of numbers easily, like 1 to 5?

Asked by 5 years ago
Edited 5 years ago

Im trying to make a group rank system but I want my code to look nice. Problem is when I try to set it so if your a certain rank you'll get a certain morph I have to do 1 and 2 and 3 and 4 which is just redundant. And it would require me to write numbers like 30 times between gaps of permissions. Any other way?

player = game.Players.LocalPlayer
Group = player:GetRankInGroup(889994)
if player:GetRankInGroup(889994) == 1-3 then
    print("Hey")

end

There ^ I was trying to select 1 to 3 My other way

player = game.Players.LocalPlayer
Group = player:GetRankInGroup(889994)
if player:GetRankInGroup(889994) == 1 and 2 and 3 and 4 and 5 then
    print("Hey")

end
1
Please post a script. We cannot read your mind, if you want help, help us first. User#19524 175 — 5y
0
I just want to select numbers easily like 1 to 5 meaning 1,2,3,4 and 5. numercookie13246 11 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Yes!

You can create a table with those numbers, seperated by a , and use in pairs to do what you want!

local numbers = {1, 2, 3, 4, 5}

for _,v in pairs(numbers) do
    player = game.Players.LocalPlayer
    Group = player:GetRankInGroup(889994)

    if player:GetRankInGroup(889994) == v then
        print("Hey")
    end
end
Ad

Answer this question