I am making a cript for data store
here is the error
ServerScriptService.PlayerDataHandler:61: missing argument #2 - Server - PlayerDataHandler:61
19:27:48.889 Stack Begin - Studio
19:27:48.889 Script ‘ServerScriptService.PlayerDataHandler’, Line 61 - function GetProfile - Studio - PlayerDataHandler:61
19:27:48.889 Script ‘ServerScriptService.PlayerDataHandler’, Line 85 - function Update - Studio - PlayerDataHandler:85
19:27:48.889 Script ‘ServerScriptService.Script’, Line 11 - Studio - Script:11
19:27:48.889 Stack End - Studio
----------------hierarchy
--------------------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”))
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)