I recently started scripting and made a shop for my simulator game the shop works and all but once i get some strength with the item i bought and sell it for some reason it gives all the coins back that i used to but the item, here is my buy item script i also put my sell script in case that helps (1st picture is sell script)
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
if plr.leaderstats.Coins.Value >= 30 then
game.ReplicatedStorage.Buy:FireServer()
end
end)