For my game I'm trying to make a chat command to give guns, such as "GLOCK 18". I want to fire a remote event to give the person the gun. However, I want the gun to be said as two different strings so "GLOCK" "18". So when a player types: :givetool GLOCK 18 it will fire Network.Storage.Weapon.[var][var2]. Var being GLOCK and var2 being 18. But it won't work.
Code:
if cmd == "givetool" then
local var = string.sub(msg,space+1)
local var2 = string.sub(var,space+1)
local string_1 = "Tool";
local userdata_1 = game:GetService("ReplicatedStorage").Network.Storage.Weapon.[var][var2];
local Target = game:GetService("ReplicatedStorage").Network.AssignEntity;
Target:FireServer(string_1, userdata_1);
end
Edit:
I'm also afraid that...
local var = string.sub(msg,space+1)
local var2 = string.sub(var,space+1)
...wont work either.

11 comments
um you write [var]][var2]
lol maybe that typo is the problem
And yes I know it's some stupid syntax mistake
I didn't mean to add the ] in my code however without it still doesn't work.
have you tried Weapon..var""..var2 ?
no but I will try
still didnt work
can i see the script with u using it?
wait i got a good idea, write local Weapn = var..""..var2 then write Weapon.Weapn
SMART
didnt work either