Here is the script:
if string.sub(message,1,7) == "health/" then local number = nil for i = 8,math.huge do if message:sub(i,i) == "/" then number = i break end end local plr = FindPlayer(message:sub(8,number-1)) local amt = message:sub(number+1) print(plr.Name.."/"..amt) end end
I tried this
--I chatted this: "health/pl/8" --it print this >Player1/8 --then i tried this "health//999" ---it print this >Player1/999 --How do you make it so that when you say this: "health/pla/999" >Player1/999 ---and if you say this: health/NoPlayerThatExist/999 --it will print nothing and not Player1/999
Thanks!!!
if message:sub(1,7) == "health/" then local number = nil for i = 1, math.huge do if message:sub(i,i) == "/" then number = i break end end local plr = FindPlayer(message:sub(8,number-1)) local amt = message:sub(number+1) print(plr.Name.."/"..amt) end