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

GetRankInGroup script does not destroy parts for high ranks?

Asked by 7 years ago
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

Log in to vote
0
Answered by 7 years ago

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
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 TheeDeathCaster 2368 — 7y
0
I think he only wants it for these specific ranks. Programical 653 — 7y
Ad

Answer this question