Sound part on spawn

Hello!
I am wondering if there is a way to play an audio whenever a part from replicated storage gets spawned into the workspace? I am trying to add a sound effect to a custom trail that I have made moves into workspace it plays a sound. Kinda like the play on removed thing but the opposite


As you can see the part called slash is getting cloned into a server called Fx so I can see the trail. Is there some kind of script I can put inside of the part “Slash” to make it play a sound as it gets cloned into workspace?

Thanks!

A quick solution would be to add a script and a sound within the instance.

script.Parent.AncestryChanged:Connect(function()
    if script.Parent:FindFirstAncestor("Workspace") then
        script.Parent.Sound:Play()
    end
end)

That should work. But ideally you should set up a more organised sound manager.

You probably don’t want to do this. It makes more sense to add whatever you want to the part – THEN play the sound. In the long run, you most likely won’t do what you currently want to do every single time.

put a script inside of workspace

and type this:

game.Workspace.ChildAdded:Connect(function() -- when a child is added to workspace
    (thesoundinstance):Play() -- play the sound instance
end)