I was trying to make a code that if you touch a coin, then the value of your coins goes up 1 more, but i tried to make and haven't sucess. Here's the code.
script.Parent.Touched:Connect(function(Player)
if Player.Parent:FindFirstChild("Humanoid") then
local Players = game.Players:GetPlayerFromCharacter(Player.Parent)
local Money = Players:GetAttribute("Coin")
Players:SetAttribute("Coin", +1)
task.wait(.2)
script.Parent:Destroy()
end end)
You’ll want to add your previously amount + 1
local Money = Players:GetAttribute("Coin")
Players:SetAttribute("Coin", Money+1) -- Add Money + 1