When the player leaves, it doesn't save the data.

local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:connect(function(player)
 local folder = Instance.new("Folder",player)
 folder.Name = "places"


 local p11 = Instance.new("IntValue",folder)
 p11.Name = "p11"
 p11.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p11.Value)
 p11:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p11.Value)
	 end)
local p12 = Instance.new("IntValue",folder)
 p12.Name = "p12"
 p12.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p12.Value)
p12:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p12.Value)
	 end)
local p13 = Instance.new("IntValue",folder)
 p13.Name = "p13"
 p13.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p13.Value)
 p13:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p13.Value)
	 end)
local p14 = Instance.new("IntValue",folder)
 p14.Name = "p14"
 p14.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p14.Value)
 p14:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p14.Value)
	 end)
local p15 = Instance.new("IntValue",folder)
 p15.Name = "p15"
 p15.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p15.Value)
 p15:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p15.Value)
	 end)
local p16 = Instance.new("IntValue",folder)
 p16.Name = "p16"
 p16.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p16.Value)
 p16:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p16.Value)
	 end)
local p17 = Instance.new("IntValue",folder)
 p17.Name = "p17"
 p17.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p17.Value)
 p17:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p17.Value)
	 end)
local p18 = Instance.new("IntValue",folder)
 p18.Name = "p18"
 p18.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p18.Value)
 p18:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p18.Value)
	 end)
local p19 = Instance.new("IntValue",folder)
 p19.Name = "p19"
 p19.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p19.Value)
 p19:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p19.Value)
	 end)
local p21 = Instance.new("IntValue",folder)
 p21.Name = "p21"
 p21.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p21.Value)
 p21:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p21.Value)
	 end)
local p22 = Instance.new("IntValue",folder)
 p22.Name = "p22"
 p22.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p22.Value)
 p22:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p22.Value)
	 end)
local p23 = Instance.new("IntValue",folder)
 p23.Name = "p23"
 p23.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p23.Value)
 p23:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p23.Value)
	 end)
local p24 = Instance.new("IntValue",folder)
 p24.Name = "p24"
 p24.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p24.Value)
 p24:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p24.Value)
	 end)
local p25 = Instance.new("IntValue",folder)
 p25.Name = "p25"
 p25.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p25.Value)
 p25:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p25.Value)
	 end)
local p26 = Instance.new("IntValue",folder)
 p26.Name = "p26"
 p26.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p26.Value)
 p26:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p26.Value)
	 end)
local p27 = Instance.new("IntValue",folder)
 p27.Name = "p27"
 p27.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p27.Value)
 p27:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p27.Value)
	 end)
local p28 = Instance.new("IntValue",folder)
 p28.Name = "p28"
 p28.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p28.Value)
 p28:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p28.Value)
	 end)
local p29 = Instance.new("IntValue",folder)
 p29.Name = "p29"
 p29.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, p29.Value)
 p29:GetPropertyChangedSignal("Value"):Connect(function() ds:SetAsync(player.UserId, p29.Value)
	 end)
end)
game.Players.PlayerRemoving:connect(function(player)
 ds:SetAsync(player.UserId, player.places.p11.Value)
 ds:SetAsync(player.UserId, player.places.p12.Value)
 ds:SetAsync(player.UserId, player.places.p13.Value)
 ds:SetAsync(player.UserId, player.places.p14.Value)
 ds:SetAsync(player.UserId, player.places.p15.Value)
 ds:SetAsync(player.UserId, player.places.p16.Value)
 ds:SetAsync(player.UserId, player.places.p17.Value)
 ds:SetAsync(player.UserId, player.places.p18.Value)
 ds:SetAsync(player.UserId, player.places.p19.Value)
 ds:SetAsync(player.UserId, player.places.p21.Value)
 ds:SetAsync(player.UserId, player.places.p22.Value)
 ds:SetAsync(player.UserId, player.places.p23.Value)
 ds:SetAsync(player.UserId, player.places.p24.Value)
 ds:SetAsync(player.UserId, player.places.p25.Value)
 ds:SetAsync(player.UserId, player.places.p26.Value)
 ds:SetAsync(player.UserId, player.places.p27.Value)
 ds:SetAsync(player.UserId, player.places.p28.Value)
 ds:SetAsync(player.UserId, player.places.p29.Value)
end)

3 comments

0

lots of things wrong with this, nobody is going to answer

0

its hurting my brain

0

some tips tho, 1) add game:BindToClose(function() wait(10) end) or so at the bottom, that might fix your issue, 2) group all values togheter in a table instead of just having a thouzand datastores (there is a max amount of SetAsyncs you can use/key/minute) 3) clone a folder instead of creating it