Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
1
Answered by
Link150 1355 Badge of Merit Moderation Voter
8 years ago

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)
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. Jord_guitar 50 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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

0
Also try to also put the sound into other services preferably ServerStorage or something, might do something. AshRPG12 42 — 8y
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. User#11440 120 — 8y
0
I don't do FE a lot but thanks for pointing that out, but a local script would work fine wouldn't it? AshRPG12 42 — 8y
0
I believe it could work. However other players would not hear the local player breathe. Link150 1355 — 8y
View all comments (2 more)
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! Scarious 243 — 8y
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. AshRPG12 42 — 8y

Answer this question