for j, l in pairs(button:GetChildren()) do
if l.BuyButton.Transparency ~= 1 then
l.BuyButton.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local money = player.leaderstats.Money.Value
local cost = l.Cost.Value
if money >= cost then
money = money - cost
print(money) -- when I print it out, the player's money got subtracted but not in the leaderstats
for i, v in pairs(FurnitureTable) do
if v.Name == l.Purchase.Value then
v.Parent = items
end
end
end
end)
end
end
hello, i made a purchase script where when a player touched a button it will subtract the player's money and the item will be purchased. But, the player's money doesn't get subtracted for a reason.

2 comments
Thanks!
i didn't know you can do that