Hello, I was making a shop for my game. And I was wondering how to subtract from the values when an item is bought.
Here is the script I was trying.
image.MouseButton1Down:connect(function()
if value > 25 then
local ball = game.ReplicatedStorage.Superball:Clone()
ball.Parent = game.StarterPack
ball.Parent = game.Players.Player.Backpack
wait (0.5)
game.Players.Player.leaderstats.Pixels.Value = value -25
This script gives a superball to the player when he buys the item, and the value of "Pixels" goes down 25 to 75 (originally 100). But when I "bought" another item for 10 Pixels the value goes to 90.
Also "value" is a variable for game.Players.Player.leaderstats.Pixels.Value
Please Help

3 comments
Please...
About to post, hold on. Stupid wait limit...
Post what 'value' is, in script form.