I know how to make a script where I kick certain users but I want to make it kick everyone that is not part of something… Like I just want the people in my group to join it…
Loop through the player list and call :IsInGroup(GroupId).
e.g:
for _, Player in ipairs(game:GetService("Players"):GetPlayers()) do
if not Player:IsInGroup(1) then -- replace 1 with your group id
Player:Kick("Sorry you're not in the group");
end;
end;
https://developer.roblox.com/en-us/api-reference/function/Player/IsInGroup
7 Likes
Pretty sure there’s a setting under your game/place that toggles so that only group members can join.
But if you do go with @Ze_tsu 's solution above be sure to wrap your :IsInGroup() function with a pcall as it does make a web request and could fail!
using player added would be a better alernative