It's my first time ever trying String patterns and i'm getting really confused on how to use them in my admin script command. What I want to be able to do is be able to say '/e clone/player/number' then the command would clone the player as many times as it says after the slash. But at the moment i've only got the findplayer part and find the slash. Please could someone help.
local isAdmin = {[14946581] = true, [122532233] = true, [17008190] = true}
function findPlayer(name)
for _,v in pairs(game.Players:GetChildren()) do
if string.lower(string.sub(v.Name, 1, #name)) == string.lower(name) then
return v
end
end
end
function onChatted(message, player)
pattern = '/'
if message:sub(1, 9):lower() == ("/e clone/"):lower()and isAdmin[player.UserId] then
victim = findPlayer(message:sub(10))
if victim and victim.Character then
message:sub(10):find(pattern)
end
end
end
Thank you.

3 comments
Isint that what it was supposed to do..?
No, I want to be able to enter a number after the slash so then my script loops that amount of times.
local num_times = message:match("%d+$") -- All numbers at the end of your string until the slash.