He wants the player after he joins the game to kick him out of the group with the given IP. I entered my group to which I belong and it doesn't work, what did I do wrong?
while true do wait(3) local Player = game:GetService("Players").LocalPlayer local ID = 11260813 if Player:IsInGroup(ID) then Player:Kick("You are kicked for being in illegal group") end end
This is a ServerScript in ServerScriptService which is best for ServerScripts
local illegalGroups = {1234567890, 987654321, 098765432} game.Players.PlayerAdded:Connect(function(client) for index, value in pairs(illegalGroups) do if client:IsInGroup(value) then client:Kick("You are kicked for being in illegal group") end end end) --[[ First, there is an array with all the illegal group IDs. (Those ID's in the array are not actual group ID's there're just to demonstrate) Next, I used a PlayerAdded event and connected it to a function. (That parameter called 'client' means the client that got added to the Players Service basically means when a client joins the server) After that, it will loop through the array. Each iteration will check if the player is in that illegal group. If they are then it will kick them otherwise, it will do nothing ]]
Any questions? Just reply to my answer