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

ROBLOX radio script?

Hi. I've successfully managed to implement a radio system in my game, however, i have noticed that only i can hear the game, other players can't. I don't know what's wrong, and i don't know who to ask, so here is my script in beg of help

wait(8)
local sound = Instance.new("Sound")
sound.Volume=1
sound.Pitch=1
sound.Name=""
sound.Looped=true
sound.PlayOnRemove=false
local player = game.Players.LocalPlayer.Character
sound.Parent = player.Radio
local Format = "http://www.roblox.com/asset/?id=##ID##"
local frame = script.Parent:WaitForChild("Frame")

frame:WaitForChild("Play").MouseButton1Click:connect(function()
	local input = tonumber(frame:WaitForChild("Input").Text)
	if input then
		sound:Stop()
		sound.SoundId=Format:gsub("##ID##", tostring(input))
		sound:Play()
	end
end)
frame:WaitForChild("Stop").MouseButton1Click:connect(function()
	sound:Stop()
end)

Please help me, thanks.

1 comment

0

Try putting the sound in something other than a local player slot. Only "Local" players can hear it. Since you are only placing it in one player, only that one player can hear it.

1 answer

I'm guessing that you mean it only works in Studio, if not forgive me.

If so the problem I found is that you only defined it to find Character in Clientside

Redefine the Player and Character like this

local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end

After that redfine anything using "player" and replace it with "character"

Again forgive me if this did not help.

2 comments

0

A better and more simpler way to do this is to use repeat wait() until player.Character.

0

I did this, not sure if i did it correctly as it doesn't even work now. Can you please post the whole script?

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