I put a click detector inside of the part, if the player clicks it, it checks for their money, if its greater than or equal to the price, the item will be in their backpack. However, whenever I click the part, I get the tool but the money does not go down, what do I do?
heres the script:
local clickButton = script.Parent
local price = 25
local brick = clickButton.Parent
local tool = game:GetService("ServerStorage").Items.ClassicSword
local clone = tool:Clone()
local brickColor = brick.Color
clickButton.MouseClick:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Cash")
local money = cash.Value
----------------------------------------script---------------------------------------
if money >= price then
clone.Parent = player.Backpack
money = money - price
end
end)
