Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script doesnt let players in even if they are part of the group?

I've got a script that kicks players if they aren't a member of a certain group, it does work, but it doesn't update. For instance, if a player tries to join and they aren't in the group, they will get kicked, but then if they join the group and try to play, it wont allow them in the game unless a new server has started. Any idea why?

local GroupIds = {3038719}
game.Players.PlayerAdded:connect(function(player)
		for _,v in pairs(GroupIds) do
				if player:IsInGroup(v) then
							print("Player is in the group")
						return false
				else
							print("Kicking the player that isnt in the group..")
						player:Kick("You are not in the Cybertale Games group! Please join it so that you can play! (Link in desc)")
				end
		
	end	
end)

Thanks for reading

2 comments

0

Try the script with line 6 removed.

0

Does the same thing :c

1 answer

local GroupIds = {3038719}
game.Players.PlayerAdded:connect(function(player)
        for _,v in pairs(GroupIds) do
                if player:IsInGroup(v) then
                            print("Player is in the group")
                else
                            print("Kicking the player that isnt in the group..")
                        player:Kick("You are not in the Cybertale Games group! Please join it so that you can play! (Link in desc)")
                end

    end 
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.