Rank kick script is not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear! I want to get the rank kick script working and kick ranks 3-8 and allow ranks 1 and 9-14 in

  2. What is the issue? Include screenshots / videos if possible! the script is kicking the low ranked players

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub i tried to fix the code no luck

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local players = game:GetService("Players").PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(10886396)<= 1 then
		player:Kick("Inccificent Rank")
	else
		if player:GetRankInGroup(10886396) >=9 then
			print("Player is Host, Co-Host, Helper")
		end
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

This solution should work with a few minor edits. Firstly, I’d define the Players service as a separate variable, and listen for PlayerAdded below. I have also adapted your code to kick all users other than the ranks you actually want, as this is probably more efficient as you don’t have to have more than one if statement.

local Players = game:GetService("Players")
local groupId = 10886396

Players.PlayerAdded:Connect(function(player)
    local rank = player:GetRankInGroup(groupId)
    if not (rank == 1 or rank >= 9) then
        player:Kick("Insufficient rank")
    end
end)

Reference:
Players
Player:GetRankInGroup

local players = game:GetService("Players")

local groupId = 10886396

players.PlayerAdded:Connect(function(player)
	local groupRank = player:GetRankInGroup(groupId)
	if groupRank > 1 and groupRank < 9 then
		player:Kick("Player has a blacklisted group rank.")
	else
		print("Player has a whitelisted group rank.")
	end
end)