(REPOST) I'm having some problems, I tried to do a tempban but there are errors with the arguments example: if i do sb/dban/mau/hello/1 it will print hello 1 but if i do sb/dban/maumaumau/hello/1 it prints
1 i tried detecting the numbers and then subtract 2 to the charpos but when i did a longer name it didn't work i tried subtracting the charpos by 1 and it gave me
h 1 and if i did sum the charpos by 3 it would print hello 1 but still if i did a longer name it gave me
1 I need help please, i've tried a lot of things but they didn't work Also please don't answer me a temporal ban system, i just need the three argument chat command, I already made the Temp ban system so please don't give me the temporal ban system
if string.sub(m,1,8):lower() == ("sb/dban/") then
local ma = string.sub(m,9)
local charPos = string.find(ma,"/")
local mama = string.sub(ma,charPos+1)
local charpos = string.find(mama,"/")
local amountofdays = string.sub(mama,charpos+1)
local numposition = 0
if string.sub(mama,charpos+1,charpos+1) == "1" then
numposition = string.find(mama,"1")
elseif string.sub(mama,charpos+1,charpos+1) == "2" then
numposition = string.find(mama,"2")
elseif string.sub(mama,charpos+1,charpos+1) == "3" then
numposition = string.find(mama,"3")
elseif string.sub(mama,charpos+1,charpos+1) == "4" then
numposition = string.find(mama,"4")
elseif string.sub(mama,charpos+1,charpos+1) == "5" then
numposition = string.find(mama,"5")
elseif string.sub(mama,charpos+1,charpos+1) == "6" then
numposition = string.find(mama,"6")
elseif string.sub(mama,charpos+1,charpos+1) == "7" then
numposition = string.find(mama,"7")
elseif string.sub(mama,charpos+1,charpos+1) == "8" then
numposition = string.find(mama,"8")
elseif string.sub(mama,charpos+1,charpos+1) == "9" then
numposition = string.find(mama,"9")
end
local name = string.sub(ma, 1, charPos-1)
local reason = string.sub(ma, charPos + 1,charpos+3)
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Name:lower():find(name:lower()) or v.Name:lower() == name:lower() then
print(reason)
print(amountofdays)
print("Work?")
end
end
end

2 comments
Your code looks pretty hectic, with you trying to split the command string into arguements using string.find() and string.sub(). I'd suggest trying out string.gmatch(). It's a function that splits a string into arguements so you would get something like {"ban", "Exo_Byte"}.
??? I have no idea to do it, i just want a way to fix without replacing the string.find or string.sub with other function