EngMohamedLish Posted June 7, 2015 Posted June 7, 2015 addEventHandler ("onClientMouseEnter", root, function(aX, aY) if spawn then -- checks if the mouse is on the button called *spawn* sound = playSound("sounds/Enter.mp3") setSoundVolume(sound, 1.0) end end) I tried putting sound, when player approach their mouth on the button, but it didn't work, no bugs, sound added in meta.xml, as well.
Walid Posted June 7, 2015 Posted June 7, 2015 Try this it should work addEventHandler("onClientMouseEnter", guiRoot, function(aX, aY) if source == spawn then local sound = playSound("sounds/Enter.mp3") setSoundVolume(sound, 1.0) end end)
EngMohamedLish Posted June 7, 2015 Author Posted June 7, 2015 Try this it should work addEventHandler("onClientMouseEnter", guiRoot, function(aX, aY) if source == spawn then local sound = playSound("sounds/Enter.mp3") setSoundVolume(sound, 1.0) end end) Bad 'sound/player' pointer @ 'setSoundVolume'(1)
Walid Posted June 7, 2015 Posted June 7, 2015 just check the element before using the specific function.
EngMohamedLish Posted June 7, 2015 Author Posted June 7, 2015 just check the element before using the specific function. Tried it, this time no error, but still no sound: addEventHandler("onClientMouseEnter", guiRoot, function(aX, aY) if source == spawn then local sound = playSound("sounds/Enter.mp3") if sound then setSoundVolume(sound, 1.0) end end end)
EngMohamedLish Posted June 7, 2015 Author Posted June 7, 2015 just check the element before using the specific function. Tried it, this time no error, but still no sound: addEventHandler("onClientMouseEnter", guiRoot, function(aX, aY) if source == spawn then local sound = playSound("sounds/Enter.mp3") if sound then setSoundVolume(sound, 1.0) end end end) Anything?
Walid Posted June 7, 2015 Posted June 7, 2015 there is nothing wrong try to use sth like this addEventHandler("onClientMouseEnter", guiRoot, function() if (getElementType(source) == "gui-button") then playSound("sounds/Enter.mp3", false) end end )
EngMohamedLish Posted June 7, 2015 Author Posted June 7, 2015 there is nothing wrong try to use sth like this addEventHandler("onClientMouseEnter", guiRoot, function() if (getElementType(source) == "gui-button") then playSound("sounds/Enter.mp3", false) end end ) I am totally confused... tried it, doesn't work. I am confused....
HUNGRY:3 Posted June 10, 2015 Posted June 10, 2015 are u trying to make a sound when player click gui button? if so function sound() if source == spawn then playSound("sounds/Enter.mp3") end end addEventHandler("onClientGUIClick", root, sound)
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