Jump to content

Error in this script, help please.


Eduardo95

Recommended Posts

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

Link to comment
  • Moderators

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 ) 

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