I am having an issue with playing a sound. Here is my code:
RadioEvent.OnServerEvent:Connect(function(Player,Message,Channel,Type)
ConfigMessage(Player,Message,Channel)
if Type == "panic" then
game:GetService("SoundService").PanicButtonSound:Play()
end
if Type == "radio" then
game:GetService("SoundService").RadioSound:Play()
end
end)
It works perfectly fine in local scripts but doesn’t work at all in server scripts. I have tried changing the location of the sound from Workspace to SoundService and even to the script’s parent, but the sound still seems to not play.
(fyi, ‘Type’ outputs ‘panic’)
My sound is up all the way, there are no errors and as I said, it works in local scripts but just not server scripts. Also, I used print earlier to check if the code is actually executing and it is. Any kind of help would be appreciated.
local function Event(Player,Message,Channel,Type)
ConfigMessage(Player,Message,Channel)
if Type == "panic" then
game:GetService("SoundService").PanicButtonSound:Play()
end
if Type == "radio" then
game:GetService("SoundService").RadioSound:Play()
end
end
RadioEvent.OnServerEvent = Event
local hookURL = ""
local hookURL2 = ""
local httpService = game:GetService("HttpService")
local RadioRemoteEvents = game.ReplicatedStorage.RadioRemoteEvents
local RadioEvent = RadioRemoteEvents.RadioEvent
local PanicEvent = RadioRemoteEvents.PanicEvent
function DisplayMessage(FrameToOutput,Message)
FrameToOutput.LineFive.Text = FrameToOutput.LineFour.Text
FrameToOutput.LineFour.Text = FrameToOutput.LineThree.Text
FrameToOutput.LineThree.Text = FrameToOutput.LineTwo.Text
FrameToOutput.LineTwo.Text = FrameToOutput.LineOne.Text
FrameToOutput.LineOne.Text = Message
end
function ConfigMessage(Player,Message,Channel)
local RadioGui = script.Parent
local FrameToOutput = RadioGui.RadioFrame:FindFirstChild(Channel)
local ConfiguredMessage = Player.Name..": "..Message
DisplayMessage(FrameToOutput,ConfiguredMessage)
end
RadioEvent.OnServerEvent:Connect(function(Player,Message,Channel,Type)
ConfigMessage(Player,Message,Channel)
if Type == "panic" then
game:GetService("SoundService").PanicButtonSound:Play()
end
if Type == "radio" then
game:GetService("SoundService").RadioSound:Play()
end
end)
For anyone wondering, I fixed my issue with this code:
local RadioAnimationTrack
local RadioAnimation = script.RadioAnimation
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char:WaitForChild("Humanoid")
RadioAnimationTrack:Play()