debounce = false

local Coin = script.Parent

local function Part(TouchPart)

if not debounce then

debounce = true

local partParent = TouchPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")


if ( humanoid ) then
		workspace.Coins.Fake.Sound:Play()
end

debounce = false
end

end

Coin.Touched:Connect(Part)

Sometimes it makes the sound when you touch a coin sometimes it doesn't

I have this in every coin

The sound is in a different coin named "Fake" referenced in the script

If anyone knows the problem please tell me

3 comments

0

I would suggest placing print functions inside the function to try and look at what exactly is happening and why the sound isn't playing.

0

For example you could print the value of debounce or the value of humanoid and see what it's saying and where it's going wrong.

0

@sheepposu how