So I have a leadersat in a folder called coins(folder is called Susy) and the issue is with the coins, Once I click on the gui to buy the item it subtracts from the leaderstat value, then as soon as I pick up another coin it adds instead of +1 coin it adds + 11, here is the code for the shop
local plr = game:GetService('Players').LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if plr.Susy.Coins.Value > 9 then
local clone = game.ReplicatedStorage.GravityCoil:Clone()
clone.Parent = plr.Backpack
plr.Susy.Coins.Value = plr.Susy.Coins.Value - 5
plr.Susy.Coins.Value -= 5
script.Parent.Parent.BruhV2.Visible = true
wait(1)
script.Parent.Parent.BruhV2.Visible = false
wait(1)
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.TextButton.Visible = true
script.Parent.Parent.Parent.DISPLAYCOINS.Visible = true
else plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value - 0
script.Parent.Parent.Bruh.Visible = true
wait(2)
script.Parent.Parent.Bruh.Visible = false
end
end)
And here is the code for the coin
local player = game.Players.LocalPlayer
script.Parent.Touched:Connect(function(hit)
game.Workspace.Misc.CoinPickup:Play()
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
plr.Susy.Coins.Value += 1
script.Parent:Destroy()
end
end)

1 comment
can you please fix that last code block? can't really understand the code like that