Playing a sound serverside

Hey,

I wan’t to play a notification sound serverside, but I can’t seem to get it to work.

Trying to use this native: PlaySoundFrontend(-1, “Beep_Red”, “DLC_HEIST_HACKING_SNAKE_SOUNDS”, 0,0,1). Obviously it works clientside but I wan’t do it serverside

You’ll have to trigger a client event from the server to play the sound. You can’t run that native from the server :wink:
So in your server script have something like this:

TriggerClientEvent('playSound', -1) -- this triggers it for ALL clients
-- syntax: TriggerClientEvent('event name', <client source/id>)

And in your client script:

RegisterNetEvent('playSound')
AddEventHandler('playSound', function()
    -- your code to play the sound goes here, along with anything else you want to do.
end)

Thank you so much!

Yeah I knew you couldn’t run natives from server, but I forgot to put the clientid in the triggerclientevent.

Appreciate the help!