Hi thanks for getting back to me. Do I just replace my current script with this one?
Probably. Try disable your script and inserting this as new one, before completely delete it.
When I replace it with your script and join the game, the leaderstats stop working.
It’s possible to behave like that because I use PascalCase for everything, so instead of your “leaderstats” I typed “Leaderstats”
I just checked and there isnt even a leader stat folder in the player
Is it something in the script that is wrong?
(all have been changed to “leaderstats” (no captiol)
it’s ok, may i ask what text would appear if you can buy the product?
if u can buy the product it would say purchase, when you buy it it would say purchased
BRUH my mistake is here:
PLS.PlayerAdded:connect(function(plr)
local Folder = Instance.new("Folder") -- never parent any object when it created, parent it only after all necessary properties and childrens are sat.
Folder.Name = "Leaderstats"
local Data = ProgressDataStore:GetAsync(plr.UserId) or default -- if there's no data, then use Default one
-- there you need way of setting up saving system for Shop. IDK how you structured it, so I'll do most basic way: with respective Values instances.
for PropName, PropValue in pairs(Data) do
local ValueType = typeof(PropValue)
ValueType = string.Upper(string.sub(ValueType, 1, 1)) .. string.sub(ValueType, 2 , -1)
local Value = Instance.new(PropValue .. "Value"])
Value.Value = PropValue
Value.Name = PropName
Value.Parent = Folder
end
Folder.Parent = plr
end)
I typed connect and not Connect .-. stupid mistake… (I’ll be shocked if this’s not reason for this to not work)
If you want to save multiple values, save them into a table or dictionary, like so
local myTableOfData = {
"cool mystical hat",
"another cool mystical hat"
}
ds:SetAsync(player.UserId, myTableOfData)
ValueObjects are not a good way to handle player data, unless you specifically want leaderstats. Most programmers store all the player’s data in a server in a table, and manipulate the table, which is then saved.