So, I'm making a script, for a coin. The coin is supposed to spin all the time, until someone touches it. When you touch it, it plays a sound, and then the coin is destroyed. Here's my script:
local part = script.Parent
local db = false
while wait() do
part.CFrame = part.CFrame * CFrame.Angles(0,0,0.1)
end
function coin(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if not db then
if human then
db = true
game.Workspace.coin.Sound:Play()
script.Parent.Parent:Destroy()
db = false
end
end
end
part.Touched:connect(coin)
The coin spins the way it should, but it doesn't destroy or play the sound. All help is appreciated! Also, output doesn't give any errors.

2 comments
no.
^ Was that necessary?