How to make a radio that sync for everyone in a car (Just like how real radio work)

  1. What do you want to achieve? An audio playing in the workspace with no volume, and then keeps fire bindable event to individual audios in the cars the info about the current ID (So the audio in car can play) and the audio name (So the player can see, GUI is already created). As well as so that when 2 or more people are listening to the radio in the car, they will be listening to the same audio at the same time lenth

  2. What is the issue? How to let Bindable event to send audio asset ID and audio name constantly (so that what player hear is synced)

  3. What solutions have you tried so far? I have already made the script for the audio playing in the workspace with no volume, a bindable event put inside replicatedstorage, a gui inside the car that shows audio name, but does not know how to let bindable event function in it and as well as how to make a script in the car that recives the bindable event being fired

This is my code for audio playing in workspace with no volume
The “Song Name” in starter GUI is just a placeholder textlabel that is invisible but need its text to be copied into the car’s radio info

local MarketPlaceService = game:GetService("MarketplaceService")
local event = game.ReplicatedStorage.Radio

local Songs = {
	7023680426, 10199337266, 5409360995, 7023861220, }
local Music = script.Parent
local SongName = game.StarterGui["Radio Info"].Frame["Song Name"]
while true do
	for i = 1, #Songs do
		local Song = Songs[i]
		local SongInfo = MarketPlaceService:GetProductInfo(Song)

		Music.SoundId = "rbxassetid://" .. Song
	    Music:Play()
		SongName.Visible = true
		SongName.Text = SongInfo.Name
		

		repeat wait() until not Music.IsPlaying
	end
end

(Below is the logic or function for my idea)

You can make it play by the server so they will all be at the same time

How do you make it so that it can be played by the server?

In a server script do sound:Play() and change its volume to how close or far a player is or however you want it to play

Sorry but I think you maybe have misunderstand me.
What I meant was like to let the music play inside the car, not the one in workspace.
Kind of like how real radios work, it will still broadcast, send signals even when you are not listening to it.
Just let me explain it again: I want the audio in workspace to send signals (in Roblox probably remote event or bindable event) constantly, like non-stop, and the audio will keep on playing inside of it. And when a player enters a car, before they do anything, the car is already reciving signals from that audio in workspace and playing the audio at volume 0. When the player clicks the radio button (already has designed with scripts) its not enabling to audio in the car to play, but change its volume to 1 so that player can hear it and thinks it as started playing audio.

If its still not clear, let me just make a simple example:
I will have this radio here, playing “Its raining taco” now inside of workspace, but at volume 0 so people can’t here it. When people jump into the car they can click the radio button and have a gui pop up (already designed with script) and the audio in the car will start playing “its rainning taco” and sync with whats the audio is playing in workspace (e.g: “Its rainning taco” at 1:32, then the car will sync and play “its rainning taco” at 1:32) This way, when another player jump into another car and click the radio button, both player will be hearing the same thing.
The reason why I put audio in the car is to let people outside the car start to hear the music fade away when the car drives away from them

Hope that this is a clearer explaination, if you still have problems, feel free to ask

So the sound is played from the car itself?
Let the player fire a remote to the server when he starts / stops the sound changing its volume and when he moves the car make the sound volume for OTHER clients ONLY feel lower so if he goes further the sound is quiter

There truly is no reliable way to exactly sync all audios on all clients to have the exact same timing. And honestly, in this case, I don’t think you’re gonna need a perfect sync, just generally the same song should be playing for everybody.

What I would do is from the server there’s a script that loops through all the cars when a new song starts and plays the audio with the current song. Every time a player joins, the server could fire a remote to the player that just joined with info on what song is playing and what time the song is at, then on the client they will loop through all the cars again and set all the audios soundids and timepositions etc.

1 Like

Hmm… that is indeed a nice solution, but I figured out a better solution now
My car spawnner set it so that whenever a player spawns a car, it will rename it to (player’s name)car
using this feature I think I can set a script in the radio button (inside of starter gui) to just adjust the volume of audio inside the car and just make the audio inside the car keep on playing by using the function of getting the player’s name so I don’t have to type every car’s name in the script
Anyway, thanks for your help, really appreciated it! :grin:

1 Like