Why can't I access this table?

PlayerData.GetSpells = function(plr)
	local PlayerSpells = PlayerLibrary[tostring(plr.UserId)][4]
	print(PlayerLibrary[tostring(plr.UserId)][4])
	return PlayerSpells
end

--Output is a table listing all of the player's spells that looks like this:

{
[1] = "Bubbles",
[2] = "Sparkles"
}

I’m trying to get the table in another script that looks like this:

Spell.CheckSpellsBeforePromotion = function(plr)
	local Spells = PlrData.GetSpells(plr)
	print("Spells:", Spells)
	end
end

--Output: Spells: nil

As you can see, PlrData.GetSpells(plr) results in the Spell module outputting nil. Why can PlrData retrieve the Player’s spell data but not send it to the Spell module?

We need more code to actually determine what the issue is

1 Like