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

Player Requirement Check Not Working?

Asked by 6 years ago

Hello! I was wondering why this script will not work. It should check that the player has the correct requirements in order to proceed onto the next stage. Would I have to wait for the child, find the first child, create an in pairs loop of will it be something else?

ReqAge = 20
GroupID = 000000

script.Parent.Parent.BEGIN.MouseButton1Click:connect(function(player)
    if player ~= nil then
        if player.AccountAge < ReqAge then
        player:Kick("You Must Be Atleast 20 Days Old To Apply!")
        if player:IsInGroup(GroupID) == nil then
            player:Kick("You Have Join The Group!")
            if player:IsInGroup(GroupID) and player:GetRankInGroup(GroupID) == 2 then
                player:Kick("You Have Been Suspended")

            else 
                script.Parent.Parent.Parent.STAGE1.Visible = false
            end
        end
    end
    end
end)

Thanks.

0
place a 'end' to close line 8 at line 10, this should fix Leamir 3138 — 6y
0
You can use a 'elseif' too Leamir 3138 — 6y
0
Oh, ok, I will try to have a play around to see what I get. Nikkasfied 43 — 6y
0
Can you be more specific about what is not working? Where does it fail ( have you debugged ? ) DigitalNative 0 — 6y

1 answer

Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago



ReqAge = 20 GroupID = 000000 script.Parent.Parent.BEGIN.MouseButton1Click:connect(function(player) if player ~= nil then local rank = player:GetRankInGroup(GroupID) if player.AccountAge < ReqAge then player:Kick("You Must Be Atleast 20 Days Old To Apply!") --elseif player:IsInGroup(GroupID) == nil then elseif rank == 0 then player:Kick("You Have to Join The Group!") --elseif player:IsInGroup(GroupID) and player:GetRankInGroup(GroupID) == 2 then elseif rank == 2 then player:Kick("You Have Been Suspended") else script.Parent.Parent.Parent.STAGE1.Visible = false end end end)

note that the rank will be 0 if not a member, so IsInGroup() is not strictly needed. (I commented out some lines and replaced them to demonstrate). Also note that using a rank to suspend people may not be a good idea as they can just leave the group and rejoin.

0
Try to always keep your indentation (whitespace at start of line) neatly to prevent errors like the one in your script! Opening an if-statement (or else/elseif, function, for loop, etc) code-block moves to the right, closing it moves indentation to the left. Nonaz_jr 439 — 6y
Ad

Answer this question