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

I can hear the sound but other players can't?

Asked by 6 years ago

Hi! I'm having trouble with this. The script works, and when I click 1, the sound works and I can hear it in my game. However, no one else can hear it.

player = game.Players.LocalPlayer
char = player.Character
humn = char.Humanoid
mouse = game.Players.LocalPlayer:GetMouse()

function KeyD(key)
    key = key:lower()
        if  key =="1" then
            sound = Instance.new("Sound")
            sound.Volume = 1
            sound.SoundId = "rbxassetid://690573922"
            sound.Parent = char.Head
            sound:Play()
            wait(3)
            sound:Destroy()
        end
end

mouse.KeyDown:connect(KeyD)

This is in a LocalScript, and changing it to a regular Script makes the sound not work at all. Any advice?

0
Is your game FE xEiffel 280 — 6y
0
The reason only you can hear it is because it is in a local script. Script runs on server, local script runs on client. So the sound is only running on your computer, not the server. How to fix it, I do not know sadly. I hoped I help a little bit though by explaining why it might not be working. TheFierceWaffle 64 — 6y
0
Yea, I figured that, which is why I copy and pasted the same script to a normal script (not a LocalScript) but all that does is make the sound not work at all. Thanks though! ShinyGriffin 129 — 6y
0
To play a sound for everyone to hear, you'll either have to use remote events to send a message to all the clients to play a sound, OR put the sound + script into a brick in workspace, which makes the sounds play in the 3d space, but you'll need a different trigger. Idk if that even makes any sense. I'm too tired... protectiveebob 221 — 6y

1 answer

Log in to vote
0
Answered by
Kulh 125
6 years ago
Edited 6 years ago

You must use a local script to call the key function, and instead of creating the sound from there, it sends an event to the server.

Then you must have a server script, that reacts to that fired event, and creates the sound on the given character.

0
Thank you, this helps a lot! How would I go on about doing that? ShinyGriffin 129 — 6y
0
Can you explain in detail what are the steps that need to be done to do this? I am new thank you! ShinyGriffin 129 — 6y
0
Thanks! ShinyGriffin 129 — 6y
View all comments (2 more)
0
I have solved the issue. I did not need a fired event for it. I used a local script to call the function, and the sound plays in 3D space in a part on the body. Thanks! ShinyGriffin 129 — 6y
0
You're welcome Kulh 125 — 6y
Ad

Answer this question