For learning purposes, I am creating a script that will create an Instance based on whatever I say.
For example; if I say, "instance/Part, workspace" it will create a part in workspace.
But I don't know how to get everything after the comma.
I also don't know how to make it required to use a comma after they say the instance.
local player=game.Players.LocalPlayer
function newInstance(name, pos)
local instance=Instance.new(name, pos) --name=name of the instance|pos=parent of the insatnce
end
player.Chatted:connect(function(msg)
if string.sub(string.lower(msg),1,9)==string.lower("instance/") then
local ins=string.sub(msg,10,#msg)
local pos --This is where I am confused. This is supposed to get everything after the comma in ins
newInstance(ins)
end
end)

2 comments
And how would I include this in the script?
Just stick the string you want to get the comma bit from into the function. It's really not that difficult, considering this is now skiddie-level implementation implementation.