The code below no longer works as I added a autosave feature in serverscriptservice, and using the player allows for people to get infinite money using hacks.
local sound = game.workspace.Money local cost = 0 local touchedalready = 0 local button1bought = false script.Parent.Touched:Connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid") and game.Players:GetPlayerFromCharacter(hit.Parent) then local ServerScriptService = game:GetService("ServerScriptService") local leaderstats = ServerScriptService:FindFirstChild("leaderstats") local cost = 0 if leaderstats then local MoneyValue = leaderstats:FindFirstChild("Cash") if MoneyValue then if MoneyValue.Value >= cost and touchedalready == 0 then touchedalready = 1 MoneyValue.Value = MoneyValue.Value - cost sound:Play() wait(0.01) button1bought = true script.Parent:Destroy() end end end end end)