Ive set my game to freinds only yet people who arent my freinds can still join it, Any ideas on how to make a script that can prevent non-freinds or certain people from joining while allowing certain people and freinds to join?
You could test if their your friends and then if not kick them
You could try this in a server script
local allowed = {
"Ziathrius",
"ROBLOX",
--Add more people you want to allow
}
game.Players.PlayerAdded:Connect(function(plr)
if not table.find(allowed,plr.Name) and not plr:IsFriendsWith(YourUserId) then
plr:Kick("You are not allowed in the game")
end
end
Everytime a player joins, it checks if they are in the list of allowed players, and if they aren’t, it checks if they are friends with you, and if they also aren’t, kick them
1 Like