When a cloned coin is picked up it runs a counter and then determines when a chest will spawn. I’ve made the coins transparency to 1 while the coin sound plays and then clone:Destroy() when ended.
I’m thinking while the coin is transparent my counter is still picking up the coin. I need a way to tell it to ignore the coin it’s already counted. A wait() simply won’t work as if a new chest is picked up while waiting it won’t be counted. Any ideas?
I picked up 1 coin!
clone.Touched:Connect(function(hit)
if not clone:GetAttribute("Touched")then
clone:SetAttribute("Touched", true)
if counter ~= 0 then
counter = counter - 1 -- still Hitting multiple times
print(counter)
else
SpawnChest()
counter = 20
print("counter is reset to 20")
end
end
clone:SetAttribute("Touched", false)
end)