I wan’t to kick my player using a button, but it doesn’t work.
Here’s the script:
script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer:Kick("See you later.")
end)
I wan’t to kick my player using a button, but it doesn’t work.
Here’s the script:
script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer:Kick("See you later.")
end)
a kick can only happen from the server. Use a remote event.
On Client:
ReplicatedStorage.RemoteEvent:FireServer()
on server:
Remote.OnServerEvent:Connect(function(Player))
Player:Kick(“See you later”)
end)
you can’t kick on the client, as otherwise exploiters could kick whoever they want. Use remote events.
Local script:
local event = game:GetService("ReplicatedStorage").Event
script.Parent.Activated:Connect(function()
event:FireServer()
end)
ServerScript:
local event = game:GetService("ReplicatedStorage").Event
event.OnServerEvent:Connect(function(plr)
plr:Kick("Byeee!!")
end)
I would recommend you add in some verification, so that only you for example can kick players, as right now this is crazily exploitable, even with it on the server. Hope this helps! :]
Are you using a server Script or a LocalScript in your button? Since the server has no LocalPlayer, therefore you need to use a LocalScript instead.
Only if you are kicking other players, otherwise you can Kick() the LocalPlayer.
From https://create.roblox.com/docs/reference/engine/classes/Player#Kick:
When using this method from a LocalScript, only the local user’s client can be kicked.
clients are just for appearances, the main system hides in the server including :Kick() (which no other player can acess)