Script Cant Find Value in Module Script

I have a local script attempting to access a value stored within a module script in a player’s tool. It finds the script, but cannot find the key within the module script. I spell them the same in both ways, so I need help figuring out why it can’t get the value.

for _, Tool in pairs(Backpack:GetChildren()) do

	Tool.Equipped:Connect(function()

		local Config = Tool:FindFirstChild("Config")
		
		if Config["CursorType"] ~= "Melee" then
			
			local Ammo = Char:FindFirstChild("Ammo")
			local AmmoType = Ammo:FindFirstChild(Config["AmmoType"])
			
			AmmoFrame.Main.Total.Text = AmmoType.Value
			AmmoFrame.Main.AmmoIcon.Image = Config["AmmoIcon"]
			AmmoFrame.Main.Clip.Text = Tool.Ammo.Value
			AmmoFrame.Visible = true
			
			Tool.Ammo.Changed:Connect(function()
				
				AmmoFrame.Main.Clip.Text = Tool.Ammo.Value
				AmmoFrame.Main.Total.Text = AmmoType.Value
				
			end)
			
		end
	end)
	
	Tool.Unequipped:Connect(function()
		
		AmmoFrame.Visible = false
		
	end)
end

Look at line 13 above.

local Config = {
	
	["Type"] = "Pickaxe";
	["ItemIcon"] = "rbxassetid://13502560808";
	["Rarity"] = "Common";
	["CursorType"] = "Melee";
	["AmmoType"] = "Nil"
}

return Config

The module in question.

Screenshot 2024-10-10 at 17.33.53

Location of the scripts.

The error.

you need to require the module first

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.