Sound not playing on Tool

Hi,

The sound won’t play when the tool is activated. How do I fix this?

image

local Tool = script.Parent
local Axeanim = Tool.Axeanim
local db = false
local sound = script.Parent

Tool.Equipped:Connect(function(Mouse)
    Tool.Activated:Connect(function()
        local Character = Tool.Parent
        if db == false then
            db = true
            local AnimationTrack = Character.Humanoid:LoadAnimation(Axeanim)
            AnimationTrack:Play()
            sound:Play() 
            wait(1) 
            db = false
        end
    end)
end)
1 Like
local sound = script.Parent.Sound
3 Likes
local Tool = script.Parent
local Axeanim = Tool.Axeanim
local db = false
local sound = script.Parent.MySound -- you should try to avoid naming instances with classes' names

Tool.Equipped:Connect(function(Mouse)
    Tool.Activated:Connect(function()
        local Character = Tool.Parent
        if not db then
            db = true
            local AnimationTrack = Character.Humanoid:LoadAnimation(Axeanim)
            AnimationTrack:Play()
            sound:Play() 
            task.wait(1)
            db = false
        end
    end)
end)
1 Like

Hi, I tried it, but it’s not playing the sound. I’m not sure what I’m doing wrong.

Any errors in the output?

Also, read my note here:
you should try to avoid naming instances with classes’ names

Yes! Your script fixed it! Thank you! :smiley: