So i've made this script that's suppose to remember how many stages the player has completed and how many trophies he's collected but it won't work even tho it doesn't show any errors.If any1 has any ideas or suggestions i'm all ears.
Thanks for your time
data = game:GetService('DataStoreService'):GetDataStore('MobbyProgres') game.Players.PlayerAdded:connect(function(p) -- Player joins local stats = Instance.new ("IntValue",p) stats.Name = "leaderstats" local stage = Instance.new("IntValue", stats) stage.Name = "Stage" stage.Value = 1 local trophies = Instance.new("IntValue",stats) trophies.Name = "TrophiesFound" trophies.Value = 0 key = 'Pinfo_'..p.userId if data:GetAsync(key) ~= nil then stage.Value = data:GetAsync(key)[1] trophies.Value = data:GetAsync(key)[2] else data:SetAsync(key, {1,0}) end end) game.Players.PlayerRemoving:connect(function(p) key = 'Pinfo_'..p.userId local save = {p.leaderstats.stage.Value, p.leaderstats.trophies.Value} data:SetAsync(key, save) end)
You name your values "Stage" and "TrophiesFound", but you attempt to save "stage" and "throphies".
Fun fact: You did get errors, but you didn't see them cause it errors the moment you leave.