I don't want low-rank recruits joining the group game, I need a rank requirement that checks the group if they are high enough. I also want raiders to join so if you are part of the group you must be this rank to join.
GroupId = "210856" function onPlayerEntered(newPlayer) if not newPlayer:IsInGroup(GroupId) then newPlayer:remove() end end game.Players.PlayerAdded:connect(onPlayerEntered)
Hi there Lengthtracked.
groupID = 210856 -- ID of the group you allow rankID = 255 -- Role ID of the whitelisted members + or - function onPlayerEntered(newPlayer) if not newPlayer:GetRoleInGroup(groupID) >= rankID then newPlayer:kick('You are not Whitelisted to join this game!') end end game.Players.PlayerAdded:connect(onPlayerEntered)
GetRankInGroup
method. Also, group IDs are numbers, not strings.local GroupId = 210856 -- use local variables local function onPlayerEntered(newPlayer) if newPlayer:GetRankInGroup(GroupId) < 3 then -- if their rank is smaller than whatever the rank you want, 3 is an example newPlayer:Destroy() end end game:GetService("Players").PlayerAdded:Connect(onPlayerEntered)
Instance:remove()
and RBXScriptSignal:connect()
are deprecated, use Instance:Destroy()
and RBXScriptSignal:Connect()
instead.Lengthtracked, to get a persons rank in a group you could use :GetRankInGroup()
like this:
GroupId = "210856" function onPlayerEntered(newPlayer) if not newPlayer:IsInGroup(GroupId) and not newPlayer:GetRankInGroup(GroupId) then -- if the rank is right and its in the group newPlayer:Kick("sorry") -- kick the player else -- you really dont need to do this print("YEY") end end game.Players.PlayerAdded:connect(onPlayerEntered)
for more info use this link https://wiki.roblox.com/index.php?title=API:Class/Player/GetRankInGroup