I want to add a command script (if it even is a script) to my game where I have some thing in my inventory and i give it to someone and is disappears from my inventory, like ones I've seen such as, ( :give/player/tool) or (:give player). I've tried a lot of other things to do it, but none work. So I've come here! If you someone could explain how i would go about doing this, that would be so appreciated! Thank you in advance!
Here is some links and code to get you started when you give us some code i will happily edit this to an answer
First of spliting a string into a table to make it like this :give player tool or :give/player/tool
If you want to split it with slashes use this
--Splitstring by slash function splitString(str) local args = {} for arg in string.gmatch(str,"./+") do table.insert(args,arg) end return args end
or if you want to split it with spaces
--Splitstring by space function splitString(str) local args = {} for arg in string.gmatch(str,"%S+") do table.insert(args,arg) end return args end
if you don't want to use slashes or spaces to split check this wikipage
now we can get the arguments like this splitString("Something Just Like This")[1]
returns Something [2] returns Just and soo on
to put the tool in another players inventory we would want to use the Parent property
for example game.Workspace.Model.Part.Parent = workspace puts the Part in workspace
Wikipages
if you have any questions or you did not understand something comment and i will edit this bible text to make you understand