Help with Concatenation with Dictionaries

Hey, I’m trying to concatenate a string value with a table, but I’m getting this error:

a

Here is the code related to it:

local PlayerBazooka
local BazookaName
   for i,v in pairs(game.ServerStorage.Bazooka:GetChildren()) do
	  for i,item in pairs(Character:GetChildren()) do
		  if v.Name == item.Name then
			  BazookaName = v.Name
              break
	      end
	  end
	end
PlayerBazooka = BazookaModule.Bazooka..(BazookaName) -- Error line
print(PlayerBazooka.Bounce)

BazookaModule is a Module Script that holds information about every bazooka, here is the BazookaModule code:

local module = {
    Bazooka = {
        ["Starter Bazooka"] = {
            Bounce = 10
        }
    }
}

return module

I wanna know how to reference a dictionary key without getting the error, somebody can help me?

You have to do Dictionary[Key] to reference a dictionary, not concatenate. So in this context, it would be BazookaModule.Bazooka[BazookaName].

1 Like