im trying to make a tool saving system but my game uses profile service and i want the tools to save with the profile service. does anyone know how to make it do so?? TY
nowodev
(Nowoshire)
May 25, 2025, 7:30am
2
Give your tools unique names or IDs, then save those names/IDs, and when loading you can just give those tools back.
yes i mean like how do i make the script to save it?? strings dont save in profile service and i dont even know how to make the script of it
nowodev
(Nowoshire)
May 25, 2025, 7:52am
4
What do you mean strings don’t save?
I won’t write entire scripts for you, you’ll need to learn the basics of Luau and how to interact with the datamodel.
i am very good at scripting and have been on roblox studio for years its just that i am new to profile service, havent rlly used it much
i tried saving strings and they didnt save; i cant find any vids about that to help me
nowodev
(Nowoshire)
May 25, 2025, 8:00am
6
Please show your code.
Also I would suggest using ProfileStore instead, as it’s the successor of ProfileService. Read the documentation if you haven’t already.
I think you meant ProfileStore , which is the newer version of ProfileService.
The topic already includes a built-in example, which I’ve used in several of my games. It also has a tutorial if you want to dive deeper!
ProfileStore Overview, Leaderstats, and Data Interface
yeah i think i use the profile store script and it works well! only problem is that i definitely do not know how to make it save the tools
i could show the code later
It has a template in the example code. Let’s say you have Bloxy Cola in your inventory, you can write a part for your player where you store a table, add the string "bloxy_cola"
, and give it back to the player when they join the game again.
The example is really helpful.
local ProfileStore = require(game.ServerScriptService.ProfileStore)
-- The PROFILE_TEMPLATE table is what new profile "Profile.Data" will default to:
local PROFILE_TEMPLATE = {
Cash = 0,
Items = {},
}
local Players = game:GetService("Players")
local PlayerStore = ProfileStore.New("PlayerStore", PROFILE_TEMPLATE)
local Profiles: {[player]: typeof(PlayerStore:StartSessionAsync())} = {}
local function PlayerAdded(player)
-- Start a profile session for this player's data:
local profile = PlayerStore:StartSessionAsync(`{player.UserId}`, {
Cancel = function()
return player.Parent ~= Players
end,
})
-- Handling new profile session or failure to start it:
if profile ~= nil then
profile:AddUserId(player.UserId) -- GDPR compliance
profile:Reconcile() -- Fill in missing variables from PROFILE_TEMPLATE (optional)
profile.OnSessionEnd:Connect(function()
Profiles[player] = nil
player:Kick(`Profile session end - Please rejoin`)
end)
if player.Parent == Players then
Profiles[player] = profile
print(`Profile loaded for {player.DisplayName}!`)
-- EXAMPLE: Grant the player 100 coins for joining:
profile.Data.Cash += 100
-- You should set "Cash" in PROFILE_TEMPLATE and use "Profile:Reconcile()",
-- otherwise you'll have to check whether "Data.Cash" is not nil
else
-- The player has left before the profile session started
profile:EndSession()
end
else
-- This condition should only happen when the Roblox server is shutting down
player:Kick(`Profile load fail - Please rejoin`)
end
end
-- In case Players have joined the server earlier than this script ran:
for _, player in Players:GetPlayers() do
task.spawn(PlayerAdded, player)
end
Players.PlayerAdded:Connect(PlayerAdded)
Players.PlayerRemoving:Connect(function(player)
local profile = Profiles[player]
if profile ~= nil then
profile:EndSession()
end
end)
nowodev
(Nowoshire)
May 25, 2025, 8:13am
10
Do note that :AddUserId()
does not automatically make it GDPR compliant, Roblox doesn’t remove the data for you.
The tutorial shows how to do it, it’s important to watch it.
oh tysm! i saw this code before but i didnt exactly know how the Items variable worked as much, but i get it now TY!!
1 Like