Shop not working

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)

change coins = coins - 25 to coins -= 25

still doesnt work

ignore this, for some reason i have to put this here

wait
i know why now so the answer is

coins should just be local coins = ls:WaitForChild(“Coins”) and then you justy need to add .Value behind every coin like coin.Value

so its local coins = ls:WaitForChild(“Coins”) if coins.Value >= 25 then
coins.Value = coins.Value - 25

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.