Been looking everywhere to find how to make this work. I have a breathing sound effect and I want it to play from the players head. This is probably completely wrong, but this is what I've been able to come up with (but doesn't work):
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function() local sound = game.ReplicatedStorage.Breathing:clone() sound.Parent = plr.Backpack wait(2) sound:play() end) end)
I assume you mean 3D sound.
If the Parent property of a Sound objects is a part, then it will seem to come from that part's position. Instead of putting it in their backpack, try putting it directly into their head.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) if character then if character:FindFirstChild("Head") then local sound = game.ReplicatedStorage.Breathing:clone() sound.Parent = character.Head wait(2) sound:play() end end end) end)
Want it specifically in the character's head? Or only the player can hear it? Maybe you need to use plr.Backpack like this: plr:WaitForChild("Backpack") which may be the cause.
Else:
For the only player to hear it, maybe trying to put it in playerGui, works for me. sound.Parent = plr:WaitForChild("PlayerGui")
For the other way, assign a character parameter variable by changing this:
plr.CharacterAdded:connect(function()
To this:
plr.CharacterAdded:connect(function(char)
And add a variable for the character's head
local head = char:WaitForChild("Head") -- waits until the character's head is available
set sound.Parent to sound.Parent = head if you have the head variable
otherwise -> sound.Parent = char:WaitForChild("Head") -- if you have assigned a char parameter variable