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

ROBLOX radio script?

Asked by 8 years ago

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.

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. minikitkat 687 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

0
A better and more simpler way to do this is to use `repeat wait() until player.Character`. HungryJaffer 1246 — 8y
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? nikolaaa4 0 — 8y
Ad

Answer this question