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.

01--Inside server script
02 
03local event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
04 
05event.OnServerEvent:connect(function(player)
06    player:Kick("lol get kicked scrub")
07end)
08 
09 
10--Inside local script which is a child of the player's backpack
11 
12local player = script.Parent.Parent
13local mouse = player:GetMouse()
14 
15mouse.Button1Down:connect(function()
16    game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer(player)
17end)

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:

1local remoteevent = nil
2 
3function kickPlr(plr)
4    plr:Kick()
5end
6 
7remoteevent.OnServerEvent:Connect(kickPlr)

and in the LocalScript:

1local remoteevent = nil
2 
3remoteevent: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:

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

this works 2

1game.Players.nameoftheplayer:Destroy()

Answer this question