I am almost done making a shop GUI and I just need to make it so it takes away the players' coins when they purchase an item. The server script somehow ignores line five and doesn't remove the current coins that the player has. I need someone's help!
local giveWeapon = script.Parent:WaitForChild("GiveWeapon")
local others = script.Parent.Parent:WaitForChild("Others")
giveWeapon.OnServerEvent:Connect(function(player, leaderboard, weapon)
leaderboard.Coins.Value = leaderboard.Coins.Value - others.Cost.Value
weapon:Clone().Parent = player.Backpack
weapon:Clone().Parent = player.StarterGear
end)
P.S. The server script is inside of the GUI and there are no errors in the output. I tried everything and I couldn't find any errors.

4 comments
Check the output? For errors and/or warnings?
There are no errors in the output. I tried everything and I couldn't find any errors.
I forgot what the parameters are, but u should try subtracting the player's coins in the localscript.
Did you try to see if others.Cost.Value is not 0?