I have this old game I am trying to revamp and it doesn't use a lot of newer systems so I'm trying to make a script(i'm semi new to scripting, friend's old game) to make it so players get the amount of money in SPS, but i'm not sure how to make it work with leaderstats.
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("CashSaveSystem")
game.Players.LocalPlayer.WaitForChild("leaderstats")
game.Players.LocalPlayer.leaderstats.WaitForChild("Cash")
M = game.Players.LocalPlayer.leaderstats
MinSpeed = 15 --Player must be going this fast in SPS to earn money.
while wait(0.65) do
script.Parent.DropMenu.CashAmount.Value = script.Parent.DropMenu.TextBox.Text
script.Parent.Money.Text = "Money: $"..M.value
if game.Players.LocalPlayer.Character.HumanoidRootPart.Velocity.Magnitude > MinSpeed and game.Players.LocalPlayer.Character.Humanoid.Sit == true then
M.Cash = M.Cash + game.Players.LocalPlayer.Character.HumanoidRootPart.Velocity.Magnitude / 1.4
end
end

1 comment
at line 14 do M.Cash.Value= M.Cash.Value because cash is the object you want to change its value because that is what the money is.