Can't access the table's values

  1. What do you want to achieve? I want to access the table’s properties

  2. What is the issue? The table that I made has another tables inside it and I can’t acces them

  3. What solutions have you tried so far? i’ve tried to look up posts at the developer hub but that didn’t help
    Module:

local weaponModule = {
	melee = {
		Sword = {
			animation = "rbxassetid://",
			aimsound = "rbxassetid://9113453270"}},
	handgun = {
		M19 = {
			animation = "rbxassetid://",
			aimsound = "rbxassetid://12220779016"
		}
	}
}
	

return weaponModule

LocalScript:

local plr = game.players.LocalPlayer
local module = require(rep:WaitForChild("weaponModule"))
mouse.Button2Down:Connect(function()
	for _, v in pairs(plr.Character:GetChildren()) do
		if v:IsA("Tool") then 
			local Type = v:FindFirstChild("type").Value
			local toolname = v.Name
			
	
			local sound = Instance.new("Sound")
			sound.Parent = v
			sound.Looped = false
			sound.SoundId = module.Type.toolsname.aimsound
			sound:Play()
		end
	end
end)

thanks for viewing my problem!

index it like this

local plr = game.players.LocalPlayer
local module = require(rep:WaitForChild("weaponModule"))

mouse.Button2Down:Connect(function()
	for _, v in pairs(plr.Character:GetChildren()) do
		if v:IsA("Tool") then 
			local Type = v:FindFirstChild("type").Value
			local toolname = v.Name


			local sound = Instance.new("Sound")
			sound.Parent = v
			sound.Looped = false
			sound.SoundId = module[Type][toolname].aimsound
			sound:Play()
		end
	end
end)

Thanks so much I was stuck figuring out how to solve it

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