This script worked before but now it won't and i can't figure out why,any input would be appreciated.
Thanks for your time
local data = game:GetService("DataStoreService")
local dataStor = data:GetDataStore("MobbyProgress3")
game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue",p)
stats.Name = "leaderstats"
local stage = Instance.new("IntValue",stats)
stage.Name = "Stage"
stage.Value = 0
local Trophies = Instance.new("IntValue",stats)
Trophies.Name = "Trophies"
Trophies.Value = 0
local Trophy1 = Instance.new("BoolValue",p)
Trophy1.Name = "Trophy1"
Trophy1.Value = false
local Trophy2 = Instance.new("BoolValue",p)
Trophy2.Name = "Trophy2"
Trophy2.Value = false
local Trophy3 = Instance.new("BoolValue",p)
Trophy3.Name = "Trophy3"
Trophy3.Value = false
key = 'MobbyProgress3_'..p.userId
local saveData = dataStor:GetAsync(key)
if saveData == nil then
stage.Value = saveData[1]
Trophies.Value = saveData[2]
Trophy1.Value = saveData[3]
Trophy2.Value = saveData[4]
Trophy3.Value = saveData[5]
else
dataStor:SetAsync(key, {1,2,3})
end
end)
game.Players.PlayerRemoving:connect(function(p)
key = 'MobbyProgress3_'..p.userId
local save = {p.leaderstats.Stage.Value, p.leaderstats.Trophies.Value,p.Trophy1.Value,
p.Trophy2.Value,p.Trophy3.Value,p.Trophy4.Value,p.Trophy5.Value,p.Trophy6.Value,
p.Trophy7.Value,p.Trophy8.Value,p.Trophy9.Value,p.Trophy10.Value}
dataStor:UpdateAsync(key, save)
end)

2 comments
i've updated my script in the meantime i'll edit it
Answer updated