Specific Ranks ban Script

Is there any scripr for that I can prevent Hotel Guests or guests joinning my group game [training center] which only Trainee+ should be there?

2 Likes

Uhm, yes using Player:GetRoleInGroup()
and it will give you the role name, so, using a

game.Players.PlayerAdded

Function, check if the role name is guest and if it’s true then kick
example:

game.Players.PlayerAdded:Connect(function(plr)
local Role = plr:GetRoleInGroup(groupid)
if role then
if role == "Guest" then
plr:Kick("You need to be Trainee+ to join!")
end
else
plr:Kick("Join group!")
end
end)
5 Likes

Use the PlayerAdded event and Player:GetRankFromGroup() function;

local GroupID = GROUPIDHERE
local MinRank = MINRANKHERE
game.Players.PlayerAdded:connect(function(Player)
    if not Player:GetRankInGroup(GroupID) >= MinRank then
 Player:Kick("StinkyNoob")
end
end)

You can find role numbers in the group admin section;

  • image
  • image
  • image
2 Likes

Thank you! :stuck_out_tongue: :heart:

1 Like

Thank you so much! :stuck_out_tongue: :heart:

You wrote “local Role = plr:GetRoleInGroup(groupid)”, but where do I put the group ID?

On where it says groupid 30chars

Alright, I tried to fix the script but I am getting an error. I litteraly know the basics about scripting as you can see.

change the both ‘role’ to ‘Role’

If you want to make it so only group members can access/play the game there is an option on ROBLOX to only allow group members to join assuming the game is published under the group.

Where to make the game group only
Configure Place > Access > Access: Group Members (yours will likely be set at Everyone) note that you will have to disable Private servers.