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

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

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

2 comments

1

Please post a script. We cannot read your mind, if you want help, help us first.

0

I just want to select numbers easily like 1 to 5 meaning 1,2,3,4 and 5.

1 answer

✓ Accepted answer

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

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