SORK>Soxxml Posted February 7, 2019 Share Posted February 7, 2019 can anyone tell me what is the problem in it? i try to make song play when player login Spoiler addEventHandler("onPlayerLogin", root, function () setTimer(function() playSound("song.mp3") end, 2000, 1) end ) Link to comment
Mr.Loki Posted February 7, 2019 Share Posted February 7, 2019 onPlayerLogin is a server event. playSound is a client event. You will need to trigger an event to the client to play the sound. Link to comment
KillerX Posted February 7, 2019 Share Posted February 7, 2019 44 minutes ago, SORK>Soxxml said: can anyone tell me what is the problem in it? i try to make song play when player login Hide contents addEventHandler("onPlayerLogin", root, function () setTimer(function() playSound("song.mp3") end, 2000, 1) end ) -- Server Side -- addEventHandler( 'onPlayerLogin' , root , function( ) setTimer( function( player ) triggerClientEvent( player , 'playSound' , player ) end , 2000 , 1 , source ) end ) -- Client Side -- addEvent( 'playSound' , true ) addEventHandler( 'playSound' , root , function( ) playSound( 'song.mp3' ) end ) Link to comment
SORK>Soxxml Posted February 7, 2019 Author Share Posted February 7, 2019 20 minutes ago, KillerX said: -- Server Side -- addEventHandler( 'onPlayerLogin' , root , function( ) setTimer( function( player ) triggerClientEvent( player , 'playSound' , player ) end , 2000 , 1 , source ) end ) -- Client Side -- addEvent( 'playSound' , true ) addEventHandler( 'playSound' , root , function( ) playSound( 'song.mp3' ) end ) thank you but its not working Link to comment
Feche1320 Posted February 8, 2019 Share Posted February 8, 2019 Check that the song exists, it should work. Link to comment
Hugo_Almeidowski Posted February 8, 2019 Share Posted February 8, 2019 17 hours ago, SORK>Soxxml said: thank you but its not working Have you made both a script for client and another one for server? Link to comment
SORK>Soxxml Posted February 8, 2019 Author Share Posted February 8, 2019 (edited) thanks guys for helping me . i fixed it. Edited February 8, 2019 by SORK>Soxxml Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now