I’ve never gotten the hang of dictionaries, I could only really do tables. I’m attempting to create a dictionary that will store the player object and then a table of items they were wearing (save outfit feature)
This is what I’ve currently got. I’m using the command bar to test this and I’m getting the error “Items is not a valid member of Player” I’m not attempting to get Items from the player itself but making one inside the dictionary.
My code:
local currentWearing = {}
local module = {}
module.CurrentWearing = function(Player, type, thing)
if type == 'Add' then
if not currentWearing[Player] then
currentWearing[Player] = Player
end
if not currentWearing[Player]["Items"] then -- error here
currentWearing[Player]["Items"] = {}
end
table.insert(currentWearing[Player]["Items"], thing)
elseif type =='Remove' then
currentWearing[Player]["Items"] = nil -- ignore this, not done yet
end
end
local model = Instance.new('Model', workspace)
module.CurrentWearing(game.Players.SovereignFrost, 'Add', model)
What I’m attempting to do
local currentWearing = {
SovereignFrost = {
Items = {'Model'}
}
}
Any help will be gladly appreciated!
tl;dr: i suck with dictionaries