you must change that to your textbox spot
also do the same for TextButton
local TextBox = script.Parent.Parent.Parent.Username
local TextButton = script.Parent.Parent.Parent.KickButton
Why are you redefining an event? Is this meant to be a StringValue? If so, use PlayerAdded.Value instead.
It’s not in existance…
Char limit.
Why are you kicking the LocalPlayer???
Because i want to do a AdminPanel…
Here’s your issue (probably):
if reason.Text == "" then
game.Players.LocalPlayer:Kick("Unknow reason given.")
else
game.Players.LocalPlayer:Kick(reason.Text)
end
Why are you kicking the LocalPlayer?
You should be kicking the victim instead:
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then victim:Kick("Unknown reason given.") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then victim:Kick(reason.Text) end
end
Yeah but… are you not trying to kick the player that the admin typed, not the admin?
Cant kick from the client, he’ll have to send the username through a RemoteEvent
Then the entire part of that script is absolutely wrong.
There’s multiple if then
so there’s errors…
That makes no sense.
if victim then victim:Kick("Unknown reason given.") end
Do you mean this?
This part detects if the victim player actually exists. if then end
causes no error. You’re going to have to use a RemoteEvent to kick them, however (according to @shadowmaster940).
It’s not the issue, it’s the issue when the admin wan be kicked even though the admin is an exepction…
I did the script differently…
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(exepct) do
if player.Name == v then
-- Add anything in here !
end
end
end)
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text.." for "..reason.Text or "an unknow reason given")
game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
game.Players.LocalPlayer:Kick(reason.Text)
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then victim:Kick("Unknown reason given.") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then victim:Kick(reason.Text) end
end
end
end)
And it still kicked me out of the game !!1!!!
Guys, the kick system could be an impossible bug…
And the Username for short is possible but really hard to find it…
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(exepct) do
if player.Name == v then
-- Add anything in here !
end
end
end)
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text.." for "..reason.Text or "an unknow reason given")
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, "An unknown reason given") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, reason.Text) end
end
end
end)
Try this
Bruh, it didn’t kicked, so no…
What do you want it to do, I thought you didn’t want to be kicked?
I want to make the expction to not be kicked…
That’s all i want for the kick button !
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
if game.Players:FindFirstChild(username.Text) then
for _,v in pairs(exepct) do
if username.Text == v then
return
end
end
print("You kicked "..username.Text.." for "..reason.Text or "an unknow reason given")
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, "An unknown reason given") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, reason.Text) end
end
end
end)
I think this should work