So I was using alvinblox's tutorial on how to make a simulator part 3, and I did the data store but when I join the game on roblox and get the numbers to what I want and then rejoin, it didn't save. Heres the code:
local serverStorage = game:GetService("ServerStorage")
local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local intelligence = Instance.new("NumberValue")
intelligence.Name = "Intelligence"
intelligence.Parent = leaderstats
local rebirths = Instance.new("IntValue")
rebirths.Name = "Rebirths"
rebirths.Parent = leaderstats
local dataFolder = Instance.new("Folder")
dataFolder.Name = player.Name
dataFolder.Parent = serverStorage.RemoteData
local debounce = Instance.new("BoolValue")
debounce.Name = "Debounce"
debounce.Parent = dataFolder
local intelligenceData, rebirthsData
local success,errormessage = pcall(function()
intelligenceData = DataStore:GetAsync("intelligence-"..player.UserId)
rebirthsData = DataStore:GetAsync("rebirths-"..player.UserId)
end)
if success then
if intelligenceData then
intelligence.Value = intelligenceData
rebirths.Value = rebirthsData
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
DataStore:SetSync("intelligence-"..player.UserId,player.leaderstats.Intelligence.Value)
DataStore:SetSync("rebirths-"..player.UserId,player.leaderstats.Rebirths.Value)
end)
end)
What is wrong here? [I did not add the size as I don't want that.]

3 comments
hmmm that should save...
you need to add a value to the numbers or it wont save
what numbers?