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

GetRankInGroup script does not destroy parts for high ranks?

game.Players.PlayerAdded:connect(function(Player)
       if Player:GetRankInGroup(1024778)== 10 or 255 or 50 or 254 then
        game.Workspace.Brick1:Destroy()
        game.Workspace.Brick2:Destroy()
    else
	if Player:GetRankInGroup(1024778) == 1 or 0 then
		print("Rank too low!")
    end
end
end)

It is supposed to destroy two parts for people who have a high rank in the group (The game is FilteringEnabled) but it doesen't destroy the parts for any rank. I have been trying to figure out whats wrong with this for hours. I'm sorry if this is a dumb question.

1 answer

255, 50 and 254 are numbers greater than 0, so the if statement will always be true. I think you just don't understand the basics. You are supposed to do this:

if this_is_true or this_is_true then

You are doing this:

if this_is_true or true or true or true then

tl;dr

if Player:GetRankInGroup(1024778)== 10 or Player:GetRankInGroup(1024778)==255 or Player:GetRankInGroup(1024778)==50 or Player:GetRankInGroup(1024778)==254 then

2 comments

0

He also doesn't have a fail-safe for when a player isn't in the group. Also, instead of doing all that hard work, why not use the ">,<" operators instead of rewriting for all that? :P

0

I think he only wants it for these specific ranks.

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