--This is a local script inside starter Gui and i am trying to make it so when i "target"player it will kick him but i am the one getting kicked + i cannot use click detector inside the player
wait(3)
local tool = Instance.new("Tool")
local players = game:GetService("Players")
tool.Parent = game.Players.LocalPlayer.Backpack
local mouse = game.Players.LocalPlayer:GetMouse()
tool.RequiresHandle = false
tool.Activated:Connect(function()
local hit = mouse.Target
local character = hit.Parent
if mouse.Target and mouse.Target.Parent then
local player = players:FindFirstChildOfClass("Player",character)
player:Kick("You've been kicked")
end
end)
✓ ANSWER ACCEPTED
How can i create kick system by clicking on a player?
1 answer
✓ Accepted answer
[https://developer.roblox.com/api-reference/function/Players/GetPlayerFromCharacter] use this function to find the player and then kick him
This discussion is preserved as it was. New answers, comments, and votes are closed.
