I got my data save button to work but i cant get my load button to work HELP?
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)