Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I play a sound from a player's head?

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)

2 answers

✓ Accepted answer

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)

1 comment

0

This works, but the sound is extremely erratic and the slightest movement makes the sound seem many studs away or right next to the head very rapidly.

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

6 comments

0

Also try to also put the sound into other services preferably ServerStorage or something, might do something.

0

To make a sound local, you can place it anywhere inside the player, not just Backpack or PlayerGui. Using PlayerGui is also bad because, with FE, scripts can't access PlayerGui.

0

I don't do FE a lot but thanks for pointing that out, but a local script would work fine wouldn't it?

0

I believe it could work. However other players would not hear the local player breathe.

0

FE isn't that hard..... Or is it? It's not if you understand it... it's really easy to learn, just use the ROBLOX wiki!

0

No it isn't hard to understand, it is hard to memorize or remember it well. I just don't experiment with FE much but I know it uses RemoteEvents and RemoteFunctions, along with invoke events and on invoke functions. Yes, I do use the ROBLOX wiki.

This discussion is preserved as it was. New answers, comments, and votes are closed.