Hi there, I am attempting to make a Text Input spawner, which will allow you to spawn NPC’s by just typing their name.
I have it working just fine spawning a single NPC but I would like the user to be able to input a number of how many NPC’s they would like to spawn, for example to spawn a single headcrab it would look like headcrab(). But to spawn say 10 headcrabs the user would input headcrab(10).
This is all the relevant code I have at the moment which all works.
local Text = self:GetEntryValue();
if Text == "headcrab()" then RunConsoleCommand("NPC_create NPC_headcrab"); elseif Text && #Text > 0 then RunConsoleCommand("say", "invalid NPC") end
Could anyone help me or give me tips on how I would get just the number between the brackets. As in my example headcrab(10), just get the number 10 from that line of text.
I hope this all makes sense and thank you in advance!