Explanation: So I am trying to make a sword shop system. When someone buys a sword, it will fire a RemoteEvent to the Server to check if they have enough Coins[currency for the game]. If they do, the server will update their leaderstats and clone the sword, they can only equip 1 sword at a time. However, the Coins value is not decreasing when the player buys a sword..
There is no error shown in the output. Output: "ClassicSword: 250 Coins"
Here's the script:
local BuyEvent = game:GetService("ReplicatedStorage"):WaitForChild("EventsFolder"):WaitForChild("BuyEvent")
BuyEvent.OnServerEvent:Connect(function(Player, BuyPrice, SwordName)
print(SwordName..": "..BuyPrice.." Coins")
local Coins = Player:WaitForChild("leaderstats"):WaitForChild("Coins").Value
if not Coins then return end
if Coins >= BuyPrice then
for i, v in pairs(Player:WaitForChild("Backpack"):GetChildren()) do
if Player:WaitForChild("Backpack"):GetChildren() == nil then return end
v:Destroy()
end
Coins = Coins - BuyPrice -- Problem Here
local SwordClone = game:GetService("ServerStorage"):WaitForChild(SwordName):Clone()
SwordClone.Parent = Player:WaitForChild("Backpack")
end
end)
Any help will be appreciated

2 comments
Thanks man
No problem!