If not in group kick problem

Normally i have a training place, that was open to everyone.
But once the people that was not in the group started exploiting, i decided to make it only allow group members.
And kick other. But since monday this week, the kick if not in group, has started to glitch, it kicks people not in group, BUT if a guest joins, it kicks EVERYONE.

What updates have been made the last week, that could cause Guest’s to crash a 18 player server by the fact that they get kicked?

and the script is as simple as this.

TRA = "165491"

game.Players.PlayerAdded:connect(function(Plyr)
    if Plyr:IsInGroup(TRA) 

then else
Plyr:Kick()
    end 
    end)
1 Like

Try this instead.

TRA = "165491"

game.Players.PlayerAdded:connect(function(Plyr)
	if not Plyr:IsInGroup(TRA)  then
		Plyr:Kick()
	end 
end)
1 Like

Whoops, deleted my last post. The problem is that IsInGroup(GroupId) takes a number, not a string, as its argument. So, instead of:

TRA = "165491"

do

TRA = 165491

instead.

EDIT: I don’t know what guests have to do with this, though… Does IsInGroup behave weirdly when used on a guest?

1 Like

The script works, it’s just that if a guest joins, it kicks everyone.

Is that the whole script, and are you sure that specific script is the cause for this behavior? There’s nothing wrong with the code logic there at all. Unless you have Plyr defined somewhere else in the script, I don’t see how this could be causing issues in this specific script. I can assure you it’s not an issue with an update.

Yes, it’s the whole script, that messes it up.

If this issue is just for guests, here is the solution:

if Player.userId <= 0 then
Player:kick()
end

If it not for guests… I have no clue.

That’s impossible for it to be kicking everyone from that script, unless ROBLOX accidentally broke :Kick() to where it shuts down the server if a guest is kicked. Master, link me to a game where you have admin that doesn’t have a group-kicker in it, and I’ll come on a guest. Kick me and see what happens.

It doesn’t need to kick you at all. It apperently kicks everyone whenever a guest joins.
And there’s no anti guest’s.

I suggest delaying the kick by a fraction of a second or so. (Probably with a coroutine so you don’t have the event stacking).

1 Like

Someone make a place, put Master3395’s script in it, and see if a Guest joining kicks all other players.

You’re using “if” statements wrong

local GroupId = 165491

game.Players.PlayerAdded:connect(function(Plyr)
    if( not Plyr:IsInGroup(GroupId) )then
        Plyr:Kick()
    end 
end)

Also if you use Id to kick guests, it will kick Player in playersolo mode.

For server scripts in playsolo…

local IsPlaySolo = (game.Players.LocalPlayer ~= nil)

[quote] [code]
local GroupId = 165491

game.Players.PlayerAdded:connect(function(Plyr)
if( not Plyr:IsInGroup(GroupId) )then
Plyr:Kick()
end
end)
[/code] [/quote]

None of you seem interested in actually reproducing the bug, if it exists, and instead are throwing out wild conjectures about how to fix his code. But how can you fix code if you don’t even understand its behavior?
That’s behaviorally no different than his code. The string passed into IsInGroup is implicitly converted to an integer and

if condition then
-- do nothing
else
  do_something()
end

is functionally no different than:

if not condition then
  do_something()
end

So basically you all are throwing out ideas on how to fix this bug. But you haven’t even reproduced the bug, so it may or may not exist.

My guess is that the Guest is really an exploiter, and he is somehow kicking everyone if he himself gets kicked as a deterrent/punishment to the other players.

1 Like

Want me to do the repro? I have 2 computers. :stuck_out_tongue:
Also, is this a server script or local?

Has to be a server script because PlayerAdded doesn’t fire locally.

Good point…
If partental controls logs me off at 2:00 (10 minutes from now), ill have to do it tomorrow. If it does not, ill do it now. Issue is the Daylight savings time is at 2:00

I have found out that this script works fine now, it’s just the new kohls admin that’s messing things up now xD

Thanks for all suggestions though :slight_smile:

1 Like