How to make game for role in group

I want to make that if player doesnt have higher or that role in group kicked. I used collaboration but then game is not visible on group page.
Script:

local groupid =  id
local rank = "role"

game.Players.PlayerAdded:Connect(function(player)
	if not player:GetRoleInGroup(groupid) <= rank then
		player:Kick("You are not a playtester!")
	end
end)
local Group = 123456789 -- Group ID here.
local RankID = 123 -- Role ID not role name.
game.Players.PlayerAdded:Connect(function(plr) 
	if plr:GetRankInGroup(Group) >= RankID then
		print("You are allowed to enter.")
		
	end
	if plr:GetRankInGroup(Group) < RankID then
		
		plr:Kick("You are not a playtester")
	end
	
end)

:GetRoleInGroup, returns rank name of the role not id. To make people access who is higher than given ID you need to use :GetRankInGroup. You can only check 1 given rank with using :GetRoleInGroup since it returns role name.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.