Jump to content

Error in this script, help please.


Eduardo95

Recommended Posts

Posted

Hello i'm new in the script world and i need a little help with this.

function startMySound() 
    sound = playSound( "1.mp3", true ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), startMySound ) 
  
function stopMySound() 
    stopSound( sound ) 
end 
addEventHandler ( "onPlayerSpawn ",  stopMySound ) 

I can't make the musica stop when player spawn, thanks

Posted

The "onPlayerSpawn" event is serverside only.

function startMySound() 
    sound = playSound( "1.mp3", true ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), startMySound ) 
  
function stopMySound() 
    stopSound( sound ) 
end 
addEventHandler ( "onClientPlayerSpawn", localPlayer, stopMySound ) 

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Worked for me. Try the code again.

Please do not PM me with scripting related question nor support, use the forums instead.

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...