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

Why is this sound only playing in studio solo, but not ingame?

Hi, this is currently the radio system I'm using. Now, when you press the emergency activation button, a line goes out on radio, and it should play the sound. (It used to work just fine). But for some reason, everything works fine, but the sound only plays in studio solo mode and not ingame?

Let me know if you have any solutions, thanks.

-Format of the radio in studio http://prntscr.com/fk7kq4

coroutine.resume(coroutine.create(function ()
Pwr = script.Parent.Power -- Do not edit
CH1 = script.Parent.CH1
CH2 = script.Parent.CH2
CH3 = script.Parent.CH3
PG1 = script.Parent.Paging1

_G["SendRadioMessage"] = function(channel, sender, message) 
if Pwr.Value ~= true then return end -- Check 1: if the power is off, do not proceed.
if channel == "1" then -- Handles channel 1 [FD-OPS-1]
	CH1.Line1.Value = CH1.Line2.Value
	CH1.Line2.Value = CH1.Line3.Value
	CH1.Line3.Value = CH1.Line4.Value
	CH1.Line4.Value = CH1.Line5.Value
	CH1.Line5.Value = CH1.Line6.Value
	CH1.Line6.Value = CH1.Line7.Value
	CH1.Line7.Value = " " .. sender .. ": " .. message
end
if channel == "2" then -- Handles channel 2 [PD-DISP]
	CH2.Line1.Value = CH2.Line2.Value
	CH2.Line2.Value = CH2.Line3.Value
	CH2.Line3.Value = CH2.Line4.Value
	CH2.Line4.Value = CH2.Line5.Value
	CH2.Line5.Value = CH2.Line6.Value
	CH2.Line6.Value = CH2.Line7.Value
	CH2.Line7.Value = " " .. sender .. ": " .. message
end
if channel == "3" then -- Handles channel 3 [TAC-1]
	CH3.Line1.Value = CH3.Line2.Value
	CH3.Line2.Value = CH3.Line3.Value
	CH3.Line3.Value = CH3.Line4.Value
	CH3.Line4.Value = CH3.Line5.Value
	CH3.Line5.Value = CH3.Line6.Value
	CH3.Line6.Value = CH3.Line7.Value
	CH3.Line7.Value = " " .. sender .. ": " .. message
end
end -- End global function

_G["SendEmergencyAck"] = function(channelN, sender) 
_G.SendRadioMessage(channelN, "[ALERT]", "EMERGENCY ACTIVATION (" ..sender ..")")
for i, players in pairs (game.Players:GetChildren()) do
wait()
if players:FindFirstChild("PlayerGui") ~= nil then
	local dsd = players.PlayerGui:FindFirstChild("OfficerRadio")
		if dsd then
			dsd.AlertSound1:Play()
end
end
end
end

_G["SendPage"] = function(msg)
PG1.Line1.Value = PG1.Line2.Value
PG1.Line2.Value = PG1.Line3.Value
PG1.Line3.Value = PG1.Line4.Value
PG1.Line4.Value = PG1.Line5.Value
PG1.Line5.Value = PG1.Line6.Value
PG1.Line6.Value = PG1.Line7.Value
PG1.Line7.Value = "[DISPATCH]: " .. msg
end

function PowerMode()
if Pwr.Value == true then
script.Parent.Light.BrickColor = BrickColor.new("Lime green")
else
script.Parent.Light.BrickColor = BrickColor.new("Bright red")
end
end
script.Parent.Power.Changed:connect(PowerMode)
end))

1 comment

0

Try removing "local" on Line 44

1 answer

It is highly recommended that all scripts within a player (PlayerGui, PlayerScripts, Backpack, etc) should be local scripts, since they run client side. That is the main reason something may not work in the actual game but in solo. Try putting your code in local scripts and making the variables local as well.

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