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

How would I disconnect a player when they are nil?

By nil, I mean that their client is still connected to the server but they have no player object in the game. I heard it had something to do with their ServerReplicator.

2 answers

✓ Accepted answer

This is the nil prevention system that Epix Incorporated Server Suite admin has

Pcall(function() if set.AntiNil and (not set.CheckAdmin(p,false)) and (not set.CheckOwner(p)) and (not set.CheckTrueOwner(p)) and (not set.CheckExcluded(p)) then Pcall(function() p:Kick() end) set.Remote(p,'Function','KillClient') for k,m in pairs(workspace:children()) do if m.Name:find(p.Name) then m:Destroy() end end end end)

The main script gives a player a local script named client when they enter the game, the local script then nils itself and continues to receive and send signals to the server. It appears to me from the script, that when a player leaves the game then the script checks if you're a admin or not. If it registers you're not an admin then it will attempt to kick you then crash you if it fails.

It appears that Kohl's Anti Exploit script, uses a similar technique

if not select(2, pcall(Workspace.GetRealPhysicsFPS)):match('GetRealPhysicsFPS') or
game.Players.LocalPlayer.Parent ~= game.Players or
not pcall(function()
		game.Players.LocalPlayer.Archivable = true
	end) or
pcall(function()
		game.Players.LocalPlayer.RobloxLocked = true
	end) then
		repeat
		until potato

If the script is able to change the RobloxLocked property, or not be able set archivable to true, or the player's parent is not in game.Players, or the script can't register the GetRealPhysics Property (It's partially a anti speed hack script), in two or more of these cases, then the script will crash the player.

I am not sure if it is possible to use ServerReplicator for something like this, but I have not researched many anti exploit scripts to know for sure. You can try out the Kohl's Anti Exploit, or Epix Inc Server Suite admin, they both provide these options.

1 comment

0

Oh, okay. I guess I'll just clone a localscript into every player and kick them if their parent is nil.

Assuming you have the variables I use defined, use this.

if plr.Character == nil then
	plr:Kick()
end

1 comment

0

"but they have no player object" - not Character object, if that were the case then you could just use the LoadCharacter method to bring them back. Also even if your code was the correct answer, you should explain it rather than just giving them code. Just giving them code doesn't teach them anything.

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