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

Not checking the group rank?

Asked by 8 years ago

It kills me yet I am in the group and am higher then rank 2. Why? Console has 0 errors

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") ~= nil then
        local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if Player then
            if Player:GetRankInGroup(2758901) == 2 then
                print("Good")
            else
                hit.Parent.Torso:Remove() -- Moved the check for humanoid up.
            end
        end
    end
end)

1 answer

Log in to vote
3
Answered by
joalars2 107
8 years ago

You are not checking for anything above rank 2!

When the code asks if Value1 == Value2, the == operator only checks if the value is equal to 2. Not if its equal to 2 or above 2.

Instead, try using the >= operator as it checks for a number or anthing above it.

Hopefully this helped ^^

Ad

Answer this question