Jump to content

playSound problem


Recommended Posts

Hey newly, I have a problem with the playsound, I can't hear my song when I login in my server

- Client

function surprise ()  
    local sound = playSound("surprise.mp3") 
    setSoundVolume(sound, 1.0) 
end 
  
addEventHandler("onPlayerLogin", getLocalPlayer(), surprise) 

- Meta

    "surprise.mp3" /> 
    

  

I hope you can help me :D

Link to comment

Well as it's shown in wiki playSound ClientSide, and onPlayerLogin is serverSide Event what we should do ?

- Use

triggerClientEvent  

- on Server

- Add the Event to ClientSide

-------ServerSide  
  addEventHandler('onPlayerLogin', root, 
   function ( ) 
    triggerClientEvent(source, 'PlaySound', source ) 
    end  
  ) 
   
-------ClientSide 
addEvent('PlaySound', true) 
addEventHandler('PlaySound', root, 
function ( ) 
     local sound = playSound("surprise.mp3") 
    setSoundVolume(sound, 1.0) 
   end 
  ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...