Jump to content

onclientguiclick play sound


greenops011

Recommended Posts

18 hours ago, Mkl said:

Hi, by using playSound inside onClientGUIClick event handler for this specific button.

You'll have add your music to the resource and then find the part where this GUI window is scripted to add playSound function inside the existing event handler.

So, would something like this work?

 

window.dialog.closeButton = guiCreateButton( 10, 60, width - 20, 40, "Close", false, window.dialog.window )
	addEventHandler( "onClientGUIClick", window.dialog.closeButton,
		function ()
			guiSetVisible( window.dialog.window, false )
			destroyElement( window.dialog.window )
			window.dialog = { }
    	    local sound = playSound("tap.wav")
            setSoundVolume(sound, 0.5)
		end
	, false )
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...