Okay this is a trainwreck, first things first:
Here’s all you need for the Client side of it (LocalScript)
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if not game.Players:FindFirstChild(username.Text) then
warn("You tried to kick "..username.Text.." but it's an invalid username !")
return
end
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text)
game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
-- Removed the LocalPlayer kick, what were you even trying to accomplish there?
end
end)
Now, if you would, please send your ServerScript that handles the “KickPlayer” RemoteEvent in ReplicatedStorage, if you don’t have one, I’ll make you one.