So I’m currently making a ban command for my admin, what I’m currently trying to achieve is that so player don’t have to write the full name of the person they are trying to ban. I’m currently using string:match(string) to find the player but it’s a little bit buggy.
Is there another way to find a player without the need of writing the full name?
My code:
if cmd == prefix.."pban" and level5 then
if args[2] == nil then
local gui = script.Parent.Guis.ErrGui:Clone()
gui.ErrText.Text = "PLEASE ENTER A USER TO BAN"
gui.Parent = player.PlayerGui
game:GetService("TweenService"):Create(player.PlayerGui.ErrGui.ErrText, TweenInfo.new(1), {TextTransparency = 0}):Play()
wait(1)
game:GetService("TweenService"):Create(player.PlayerGui.ErrGui.ErrText, TweenInfo.new(1), {TextTransparency = 1}):Play()
elseif level5 then
for _,players in pairs(game.Players:GetChildren()) do
if string.lower(players.Name):match(string.lower(args[2])) then
players:Kick(pb)
datastore:SetAsync(players.UserId, true)
end
end
end
end