local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:WaitForChild("RemoteSAVE")
local DataStore = game:GetService("DataStoreService")
local SaveCash1 = DataStore:GetDataStore("ExampleDataStore")
local RemoteLOAD = repStorage:WaitForChild("RemoteLOAD")


game.Players.PlayerAdded:connect(function(player)
	local leader = Instance.new("Folder",player)
		leader.Name = "leaderstats"
			local Bricks = Instance.new("IntValue",leader)
				Bricks.Name = "Bricks"
					Bricks.Value =  0
						SaveCash1:SetAsync(player.UserId, Bricks.Value)
	



remote.OnServerEvent:connect(function(player )
	print(Bricks.Value.. "Saved")
	SaveCash1:SetAsync(player.UserId, Bricks.Value)	
end)



RemoteLOAD.OnServerEvent:connect(function(player )
	Bricks.Value = SaveCash1:GetAsync(player.UserId)
end)




wait(5)
	for i = 1, 1000 do
		wait(.5)
			game.Players.Abrobot.leaderstats.Bricks.Value = game.Players.Abrobot.leaderstats.Bricks.Value + 1	
		end
	end)

5 comments

0

Wth is this script, you also forgot an end after line 14

0

Another problem is that your saving the moment the player joins wich means he won't have time to load in his values and it wiill get overwritten

0

I don't know what you mean about the missing end, but i see sew what you meant at line 15 and i fixed it i must have forgot to delete it.

0

Thank you so much its people like you that are what makes scripting helpers great.

0

Oh that end is at lind 38 btw