Howdy,
I am making a database module that is similar to profile service & data keep. I keep running into an issue. Data will NOT save.
Can someone look at the code and explain why its not saving?
(There are no syntax errors and every bit of data “Session_Locked” exists)
function module:SaveProfile(Player: Player)
print("SaveProfile was fired!")
local DData = SessionData[Player.UserId] or PlayerTemplate
print("Has data!")
DData["Session_Locked"] = false
print("Request")
DataStoreService:GetDataStore("PlayerDS"):SetAsync(Player.UserId, DData)
print("Saved!")
--local success, err = pcall(function()
--print("Requesting Sync")
--print("Synced")
--end)
--if success then
-- print("Saved", Player.Name.."'s data!")
--else
-- warn("Couldn't save player data:", err)
--end
--[[if Players[Player.Name] then
SessionData[Player.UserId]["Session_Locked"] = true
end]]
end
I’ve tried both PlayerDS:SetAsync(Player.UserId, Data)
and DataStoreService:GetDataStore("PlayerDS"):SetAsync(Player.UserId, Data)
Any thoughts?