So I am trying to make a command bar, and one of the commands is !givecash , . Whenever you press the ReturnEnter it should fire the event. Now while there is no problem with that, I do have a problem finding the amount of cash they would like to give the player. It should like something like this in the command bar: !givecash suspectshot108 515000. So my question is how do I find the amount? I know I can find the player with string.sub() and amount with string.sub() and awhile that is working I am lost on a way to get the amount.
LocalScript: Some code is taken out
if(string.sub(CommandLine.Text,1,10)) == string.lower("!givecash ") then
local target = game.Players:FindFirstChild(string.sub(CommandLine.Text,11))
local ammount = string.sub(CommandLine.Text,12)
print(target,ammount)
game:GetService("ReplicatedStorage").AdminEvents["CE"]:FireServer(target)
end

9 comments
Well I don't know that the total amount is 12; That was just a guess, but I do know the total sub all the way to 11
12 is the amount of characters inside ":givemoney "
if it was "!givecash " then it would be 11 characters
You're mistaken, there are 11. 2 special + 9 reg characters, so 11.
Yes, !givecash. That is the command I am going for.
changed my answer to use the "!givecash " prefix
Thanks
also if your using :GetPlayers(), use v.Name or it'll error
you can also use
string.find()too, but then thats a different story