So I have an admin panel I'm making, and I just finished making the Server Ban(Works fine), but when I finished the Kick command it won't work. What's happening, and can you please help? I know it can't be the button as I have it print right after sending the user's username.
local admins = {
---UserNames
["vincentthecat1"] = 1;
["Havok_Ninja"] = 2;
["EatSomeSand123"] = 3;
---UserId's
[150334552] = 1;
[21010010] = 2;
[896303435] = 3;
}
game.Players.PlayerAdded:Connect(function(player)
if admins[player.Name or player.UserId] then
local clone = script["Admin Panel"]:Clone()
clone.Parent = player.PlayerGui
end
end)
---Server Ban Handler
game.ReplicatedStorage.ServerBanEvent.OnServerEvent:Connect(function(player, victim, reason)
if admins[player.Name or player.UserId] then
local found = game.Players:FindFirstChild(victim)
local foundClone = script.victimName:Clone()
if found then
foundClone.Parent = game.Workspace.ServerBans
foundClone.Name = found.Name
foundClone.Value = found.UserId
found:Kick(reason or "You have been banned.")
end
game.Players.PlayerAdded:Connect(function(player)
if game.Workspace.ServerBans:FindFirstChild(player.Name) then
player:Kick("You are banned from this server.")
end
end)
---Kick Command(not working)
game.ReplicatedStorage.ServerKickEvent.OnServerEvent:Connect(function(player2, victim2, reason2)
if admins[player.Name or player.UserId] then ---checks if admin
local foundKick = game.Players:FindFirstChild(victim2)
if foundKick then
foundKick:Kick("You have been kicked.") ---kicks(does not work)
end
end
end)
end
end)

1 comment
Thanks for the help!