Sound:Play() wont load in my script?

Ello fellow devforum users, I have just started working with sounds in scripts and in general, and I have absolutely 0 clue on why this sound wont load? or in general, no sounds are loading. I checked the roblox api references but didnt find anything… Can someone help?

Script:

local tool = script.Parent
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://7873962022"
local track
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://664046210"

tool.Activated:Connect(function()
	
	if sound.IsLoaded then
		track = script.Parent.Parent.Humanoid:LoadAnimation(Anim)
		track.Priority = Enum.AnimationPriority.Action
		track.Looped = false
		sound:Play()
		track:Play()

		wait(0.5)
		track:Stop()
		sound:Stop()
	else do
			return
		end
	end

		
end)


thanks in advance

1 Like

You forgot to parent the sound object to something. Workspace for global sound, or a part for local sound.

4 Likes

You can also parent them to an “Attachment” instance for sound to be played in the vicinity of the player.

1 Like