I am attempting to get a boolean from a function parameter, In which it is returning with the wrong item.
function API.GetPlayerData(Player)
return {
GetRoles = function()
--Unrelated
end,
GetData = function(Remove)
local UserId = Players:GetUserIdFromNameAsync(Player.Name or Player)
print(Remove)
if Remove == true then
if API.RegisteredData[UserId] ~= nil and not Players:GetPlayerByUserId(UserId) then
API.SavePlayerData(UserId)
API.RegisteredData[UserId] = nil
end
else
if not API.RegisteredData[UserId] then
return API.LoadPlayerData(UserId)
else
return API.RegisteredData[UserId]
end
end
end,
}
end
In this function I laid out, I am attempting to remove no longer used playerdata by calling the function “GetData(true)”, However this is coming with complications, as when I try to print the remove parameter, It simply returns with
["GetData"] = "function",
["GetRoles"] = "function"
When it needs to return a boolean. Attached below in the final sample is how I call for data to be removed.
DataService.GetPlayerData(Player):GetData(true)