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

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

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?

4 comments

0

Is your game FE

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.

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!

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...

1 answer

✓ Accepted answer

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.

6 comments

0

Thank you, this helps a lot! How would I go on about doing that?

0

Can you explain in detail what are the steps that need to be done to do this? I am new thank you!

0

Thanks!

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!

0

You're welcome

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