:Disconnect() is supposed to "Disconnects the Roblox client from the given server. The associated player, if any, is removed on the server. Nothing happens on the client." AKA disconnect a player from the game.
So I used it in a simple script that disconnects the person from the game when they click a gui button:
script.Parent.MouseButton1Click:connect(function() game.Players.Player1:Disconnect() end)
But when fired, it gave me "Disconnect is not a valid member of Player". So if that's not how I use the method, then how do you?
script.Parent.MouseButton1Click:connect(function() game.Players.Player1:Kick() end)
Try the Kick()
method this shall work and help you immensely.
The Kick()
method disconnects the player from the game.
~ Happy Scripting HexC3D
if this helped +1, if this answered your question check mark :)