--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)
[https://developer.roblox.com/api-reference/function/Players/GetPlayerFromCharacter] use this function to find the player and then kick him