How would I also allow specific users not to be kicked?

I want to allow certain people that may not yet meet the requirements in the group or may not be in the group to get through without being kicked. I wasn’t able to find a successful way that would allow me to do this and it would just kick anyone who touched the part.

I have tried to search up a solution on how I could do this on google but haven’t found any videos/articles on how I could fix this.

Here is the script that I currently have that was kicking everyone that touched the part.

local plr = game.Players.LocalPlayer
local GarageDivider = game.workspace.ZZZ

GarageDivider.Touched:Connect(function(hit)
	if hit.Parent.Name == plr.Name then
		if plr:GetRankInGroup(123456) <= 223 or if plr.UserId ~= 123456789 or 987654321 then
			plr:Kick("You do not have permission to enter this area.")
		end
	end
end)

1 Like

You only have to use “if” once.
You used it again after or.

if plr:GetRankInGroup(123456) <= 223 or plr.UserId ~= 123456789 or 987654321 then

idk if thats gonna fix your problem or not but regardless you shouldn’t put if again.
Also do this.

if plr:GetRankInGroup(123456) <= 223 or plr.UserId ~= 123456789 or plr.UserId ~= 987654321 then

plr.UserId ~= 123456789 or 987654321 wont work. I used to think the same thing lol.

Thank you for your help. It is working now.

1 Like

Glad I could help! Goodluck! :slightly_smiling_face: