I am making a game with trading cards and want to add a grading system, the system works fine, but the player is not losing coins
the following script is in a regular script in a proximity prompt
script.Parent.Triggered:Connect(function(plr)
local char = plr.Character
local parts = char:GetChildren()
for i = 1, #parts do
if parts[i]:IsA("Tool") then
local ls = plr:WaitForChild("leaderstats")
local coins = ls:WaitForChild("Coins").Value
if coins >= 25 then
coins = coins - 25
local graderan = math.random(1,4)
local card = parts[i]
local name = card.Name
if graderan == 1 then
card.Name = ("Gold graded "..name)
end
if graderan == 2 then
card.Name = ("Silver graded "..name)
end
if graderan == 3 then
card.Name = ("Bronze graded "..name)
end
if graderan == 4 then
card.Name = ("Replica graded "..name)
end
end
end
end
end)