Help with calling hotbar in profile service

I want to call a table within a table for my data store, how would I go about doing that
here is my scripts

----------------hierarchy
image

--------------------Atributtes
local Atributes = {}

Atributes.Statistics = {
[“Level”] = 0,
[“Gold”] = 0,
[“Kills”] = 0

}

Atributes.Inventory = {}

Atributes.HotBar = {
[“Slot_1”] = “Empty”;
[“Slot_2”] = “Empty”;
[“Slot_3”] = “Empty”;
[“Ult”] = “Empty”
}

Atributes.Tools = {
[“Weapon”] = “Fists”;
[“Utility”] = “None”

}

return Atributes

--------------------------Player Data Handler

local PlayerDataHandler = {}

local ProfileStore = require(script.Parent:FindFirstChild(“BaseModules”):WaitForChild(“ProfileService”))
local dataTemplate = require(script:WaitForChild(“Attributes”))

local players = game:GetService(“Players”)

local profileStorage = ProfileStore.GetProfileStore(
“PlayerData”,
dataTemplate
)

local profiles = {}

local function PlayerAdded(player)
print(player)
local profile = profileStorage:LoadProfileAsync (“Player_”…player.UserId)

if profile then
	profile:AddUserId(player.UserId) -- loads profile 
    profile:Reconcile() 
 
	-------------------------------------------------------------------------------------
	profile:ListenToRelease(function()
		profile[player] = nil
		player:Kick()
	end)
	-------------------------------------------------------------------------------------
    if player:IsDescendantOf (players) then
        profiles[player] = profile 
        print(profiles[player])
	else
		profile:Release()
	end
    --------------------------------------------------------------------------------------
else
    print("New Player")

end

end

function PlayerDataHandler:Init()
for _ , player in game.Players:GetPlayers() do
task.spawn(PlayerAdded, player)
end
game.Players.PlayerAdded:Connect(PlayerAdded)

game.Players.PlayerRemoving:Connect(function(player)
    if profiles[player] then
        profiles[player]:Release()
    end
end)

end

local function GetProfile (plr)
assert(profiles[plr], string.format(“Data does not exist for %s”… plr.UserId))
return profiles[plr]
end

–Get/Set Data

function PlayerDataHandler:Get (Player, data)

local profile = GetProfile(Player)
assert(profile.Data[data], string.format("Data does not exist for %s",data))

return profile.Data[data]

end

function PlayerDataHandler:Set (Player, data, value)
local profile = GetProfile(Player)
assert(profile.Data[data], string.format(“Data does not exist for %s”,data))
assert(type(profile.Data[data] == type(value)))

profile.Data[data] = value

end

function PlayerDataHandler:Update (Player, data, callBack)
local profile = GetProfile(Player)

local oldData =  self:Get(Player, data)
local newData = callBack(oldData)

self:Set(Player, data, newData)

end

return PlayerDataHandler

—Function for giving gold test

local playerDataHandler = require(script.Parent.PlayerDataHandler)
local ProfileStore = require(script.Parent:FindFirstChild(“BaseModules”):WaitForChild(“ProfileService”))

playerDataHandler:Init()

game.Players.PlayerAdded:Connect(function(plr)
playerDataHandler:Update(plr, “Statistics”, 100)
end)

To find specific information in your script, you’ll need to use Atributes and HotBar. For example, if you want to access Slot_1 in the HotBar table, you would use Atributes.HotBar.Slot_1. this works in functions like PlayerDataHandler.

1 Like

yes but I cant call that through the script call that

I am trying something new for my data giver but there is a bug that i am working on fixing

here is the new data giver code

local playerDataHandler = require(script.Parent.PlayerDataHandler)
local ProfileStore = require(script.Parent:FindFirstChild(“BaseModules”):WaitForChild(“ProfileService”))
local Attribute = require(script.Parent:WaitForChild(“PlayerDataHandler”):FindFirstChild(“Attributes”))

playerDataHandler:Init()

game.Players.PlayerAdded:Connect(function(plr)
print(plr.UserId)
playerDataHandler:Update(plr, “Inventory” , function(currentInventory)
table.insert(currentInventory, “Wooden_Sword”)
end)
end)

Hmmm I can’t find anything but a typo in the code which is that you used curly marks try something like this

local ProfileStore = require(script.Parent:FindFirstChild("BaseModules"):WaitForChild("ProfileService"))