local script:
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.UpdateData:FireServer()
end)
server script:
local DStoreService = game:GetService("DataStoreService")
local CashStore = DStoreService:GetDataStore("Cash")
game.ReplicatedStorage.UpdateData.OnServerEvent:Connect(function(plr)
local MaxHealth = game.Workspace:WaitForChild("player.Name"):WaitForChild("Humanoid").MaxHealth
local CashValue = plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value
CashStore:SetAsync("plr_"..plr.UserId, CashValue, MaxHealth)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local MaxHealth = game.Workspace:WaitForChild("player.Name"):WaitForChild("Humanoid").MaxHealth
local CashValue = plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value
CashStore:GetAsync("plr_"..plr.UserId, CashValue, MaxHealth)
end)
it wont save my progress

4 comments
I dont think you can 3 parameters inside the line 14 I think you can only put 2
put*
ok
ok