Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you kick players through a localscript?

Asked by
Astilev 30
8 years ago

With the removal of Player:Remove(), is there still a way to kick players through a localscript?

0
This is a task for the server not a local script. User#5423 17 — 8y

4 answers

Log in to vote
1
Answered by 8 years ago

Turn on Filtering Enabled which is highly recommended to keep your servers secure and use remote events and functions to communicate between the server and client. This is how I would kick the player every time they click on their mouse.

--Inside server script

local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

event.OnServerEvent:connect(function(player)
    player:Kick("lol get kicked scrub")
end)


--Inside local script which is a child of the player's backpack

local player = script.Parent.Parent
local mouse = player:GetMouse()

mouse.Button1Down:connect(function()
    game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer(player)
end)

If you would like some more help on filtering enabled,remote events, and remote functions, here are some useful links: http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial http://wiki.roblox.com/index.php?title=API:Class/RemoteEvent http://wiki.roblox.com/index.php?title=Security

Ad
Log in to vote
1
Answered by 6 years ago

There is still one way. You could make a RemoteEvent and put the Event in a secure folder so exploiter cannot abuse the event. Then you can do something like this:

local remoteevent = nil 

function kickPlr(plr)
    plr:Kick()
end

remoteevent.OnServerEvent:Connect(kickPlr)

and in the LocalScript:

local remoteevent = nil 

remoteevent:FireServer()

Instead of nil put the location of the event such as: game.ReplicatedStorage.KickEvent

Log in to vote
0
Answered by 5 years ago

So you can also do this:

game.Players.useryouhate:Kick("Reason")
Log in to vote
-1
Answered by
lyxture 27
8 years ago

this works 2

game.Players.nameoftheplayer:Destroy()

Answer this question