Getting certain text from message

Hey guys, I’m making an admin bar and want to add a command like:

ban {player.Name} or kick {player.Name}

But I do not know how you would get the player’s name from the text any help is appreciated!

one option you could try is this

for i, v in pairs(game.Players:GetPlayers()) do
    if v.Name == StringNameFromCommand then
        -- v would be the player so you could ban or kick them in here
    end
end

basically this would loop through every player, eventually getting the player the command asked for

How would you check if /ban or /kick was executed though?

You’ll have to send a RemoteEvent from the client, to the server if you want the chat to receive its command outputted back

When the RemoteEvent is fired from the client to the server, it’d loop through all the players & check if that specific player is equal to what you want to search for in order to kick them (Provided you passed a message as 1 of its parameters)

--Server Script inside ServerScriptService
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(Player, TargetToKick)

    for _, Target in pairs(game.Players:GetPlayers()) do
        local NoCaps = string.lower(Target.Name) --So that we can ignore any caps for the user

        if NoCaps == TargetToKick then 
            Target:Kick("You have been kicked from the server")
        end
    end

end)