You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I wan’t to achieve an rank only game, that when an player with an certain rank can join the game but if he doesn’t have the rank needed he will get kicked out of the game.
What is the issue? Include screenshots / videos if possible!
The issue is that I’ve tryed finding tutorials but I didn’t find any that wpuld be helpfull.
What solutions have you tried so far?
I’ve trid an code, but it didn’t work, it gave me some errors, soo that’s why I am coming here.
If you enter into the roblox beta program, there’s a feature to do this in Game Settings once enabled in studio after signing up with the roblox beta program. It’s very simple doing so this way, after opting in it should show this in Game Settings:
This is only when the game is private. And you can’t vote private game. So it is good solution for something for few people, but bad solution for open game.
As @mistr88 said, if you have a group, you can use GetRankInGroup to check if a player’s rank in the group is less than a specific rank. If so, kick them from the game, else, let them in.
local Players = game:GetService("Players")
local GroupID = 0 -- replace this with your group id
local GroupRank = 2 -- the mininum group rank. this can be assigned between 0 and 255.
Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(GroupID) < GroupRank then
player:Kick("You have been kicked from the game.") -- kick them
end
end)