You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to achieve something like how forsaken saves your characters, your character skins, and what you have equipped
What is the issue? Include screenshots / videos if possible!
I’m struggling to find any solutions on my issue
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried to see if tables would work but it feels wrong to use a table to store the current thing equipped and the player’s inventory. I’ve tried YouTube tutorials but they don’t help
I’d recommend using ProfileStore, but here’s a rough example on how to get data if you plan on writing your own code to handle it:
-- Options --
local GET_MAX_ATTEMPTS = 3
-- Services --
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local playerDataStore = DataStoreService:GetDataStore("PlayerData")
local function getPlayerData(userId: number)
for _ = 1, GET_MAX_ATTEMPTS do
local success, data, keyInfo: DataStoreKeyInfo = pcall(playerDataStore.GetAsync, playerDataStore, "Player"..userId)
if success then
return data, keyInfo
end
warn(data)
end
end
Players.PlayerAdded:Connect(function(player)
local playerData = getPlayerData(player.UserId)
if not playerData then
return
end
print(playerData)
end)