I am making a piece of code that will detect a prefix to a command. E.G the command is
local command1 = "run!"
But I need the command to be either lowercase/uppercase and the script should not care. But the problem I have is, you use the command like this in chat:
Run!print("ExAmPLE")
or
run!print("ExAmPLE")
I have tried my own method but it has lots of problems and bugs. This is a sample of my code:
for _, v in pairs(game.ReplicatedStorage:GetDescendants() and game.Workspace:GetDescendants()) do
if v:IsA("RemoteEvent") then
v.OnServerEvent:Connect(function(player, input)
local lua = string.lower(input)
local splitlow = string.split(lua, "!")
local splithigh = string.split(input, splitlow[1])
loadstring(splithigh[2])()
end)
end
end
This just returns an error. I don’t have much experience with these:
string.split()
string.lower()
If someone could help me with this I would be really happy! Thank you for reading.