Since using your script in a new place worked for me, can you try that as well to see if its because of where you’re using it or something else
also may we see the script and its hierarchy if that’s the case? just to completely confirm that everything is placed correctly
I can’t see the issue here since I can’t seem to reproduce it
Also also, try put a print statement at the end of your script. if nothing is being printed then something is keeping the script back. Likely one one of the WaitForChilds.
My attempt did return with a print statement, check if yours does as well or if something prevents it
Can you send a screenshot of the hierarchy so we can see if everything is correct? Like @fellow_meerkat said, you may be trying to use a server script to access something that’s local. or, you could be getting an infinite yield. the script itself isn’t the issue but you’re likely getting something incorrect with your hierarchy which we haven’t seen yet
Given what you have said, it should look like this. The only variable we don’t know about is the script itself and whether its local or not
If nothing is playing, then the audioID may be invalid, private or was removed by roblox. If you save the current ID somewhere and then replace the SoundId of the “Sound” object to another sound then check if it works. if it does then the sound you were trying to use won’t work.
You can try using rbxassetid://9118467835 for example since this is what I used to test if the script was working on my side, you should hear a sound of a robot whir / alarm
Changing roblox character sounds makes the sound script assume you want to turn all of them off. You’ll need to make a custom character sound script for this to work!
I’d assume you are trying to play a death sound whenever the player dies.
Can’t you just do something simple as adding a script inside of StarterCharacterService and just type this in? (Add your death sound inside of the script)
local Character = script.Parent
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
Character:FindFirstChildWhichIsA("Humanoid").Died:Connect(function()
local Sound = script:WaitForChild("DeathSound"):Clone()
Sound.Parent = HumanoidRootPart
Sound:Play()
end)
I should have read all the messages. I just saw a picture where you are using a LocalScript. Well, I guess that’s my mistake then. But I guess I will still let my post be in here
You are probably using a ServerScript. You should use a LocalScript instead because the sounds inside the HumanoidRootPart only exist on the client. That means a ServerScript can’t have access to these sounds (Except if you use a RemoteEvent I guess, but it would be better to use a LocalScript instead).
If we switch to the ServerSide while testing the game, … With this button
then you can see that the sounds don’t exist on the ServerSide, so a ServerScript is kinda useless here.
If you go to the ClientSide again you can see that the sounds are there again.
So try using a LocalScript. It seems to work fine for me
Also it’s better to use this instead:
local HumanoidRootPart = script.Parent:WaitForChild("HumanoidRootPart")
HumanoidRootPart:WaitForChild("Died").SoundId = script:FindFirstChild("Sound").SoundId
The third WaitForChild command is replaced with FindFirstChild. That’s because the sound already is inside the script from the beginning.