Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I go about making a username autocorrect system for my admin commands?

Asked by
chasedig1 115
5 years ago

Hello ScriptingHelpers forum, I have quite a tight issue today for my admin commands, more specifically for my cafe, but I could make it for anything really. In my cafe/wherever the admin commands are, I want to be able to have the name be autocorrected. For example, if I type in ":handto chase", it will give to chasedig1. If there are 2 chases, it will do whatever is alphabetically first. How will I go about this? I already have the admin commands working for the full name, but I don't want my staff/users being forced to type in a full name and no admins commands are open source so I am not currently able to find out how to do this.

Basically, I need a system to allow people to not have to type insanely long usernames. Plus, trolls might come in with insanely annoying-to-type usernames and just annoy staff because their username is hard to type for every item they want.

Here is code for one of my commands, just in case you need it.

        --Check Worker Points command
         if string.sub(msg,1,19) == prefix..string.sub("CheckWorkerPoints ",1,19) then
            if player:IsInGroup(game.ReplicatedStorage.Configuration.GroupId.Value) then
                if player:GetRankInGroup(game.ReplicatedStorage.Configuration.GroupId.Value) >= game.ReplicatedStorage.Configuration.MinWorkerId.Value then
                    --print(string.sub(msg,19,string.len(msg)))
                    local playerToCheckName = string.sub(msg,20,string.len(msg))
                    local WorkerPointsValue = (game.Players[playerToCheckName].data.WorkerPoints.Value)
                    local playerToCheckName = string.sub(msg,20,string.len(msg))
                    --print(game.Players[playerToCheckName].data.WorkerPoints.Value)
                    game.Players[player.Name].PlayerGui.CheckWorkerPointsGUI.Frame.Visible = true
                    game.Players[player.Name].PlayerGui.CheckWorkerPointsGUI.Frame.WorkerPointsAmountLabel.Text = WorkerPointsValue
                    wait(3)
                    game.Players[player.Name].PlayerGui.CheckWorkerPointsGUI.Frame.WorkerPointsAmountLabel.Text = "#"
                    game.Players[player.Name].PlayerGui.CheckWorkerPointsGUI.Frame.Visible = false
                end
            end
        end

You don't need to code me an entire system, I just want a way how to, the logic, the function, etc.

Answer this question