^iiEcoo'x_) Posted January 15, 2017 Share Posted January 15, 2017 Hello I want to do any of the player presses the mute button takes addEventHandler("onClientGUIClick",root, function() if source == GUIEditor.button[1] then triggerServerEvent ( "UnAFK", localPlayer ) guiSetText ( GUIEditor.button[1], "AFK" ) end end ) addEvent('GoToAFK', true) addEventHandler('GoToAFK',root, function(player ) exports.voice:setPlayerChannel ( player , 6 ) exports.voice:setPlayerMuted ( player, true) end ) Link to comment
LoPollo Posted January 15, 2017 Share Posted January 15, 2017 (edited) triggerServerEvent ( "UnAFK", localPlayer ) -> addEvent('GoToAFK', true) + addEventHandler('GoToAFK' wtf??? setPlayerMuted???? nope: see here, i think you wanted that PS: about the handler, do not trusts clients: --replace function(player ) exports.voice:setPlayerChannel ( player , 6 ) --with function( ) player = client exports.voice:setPlayerChannel ( player , 6 ) player was not the client localplayer, which was the source: player was nil. also do not use source, use client: it's the predefined variable that contains the player that triggered the event Edited January 15, 2017 by LoPollo Link to comment
^iiEcoo'x_) Posted January 15, 2017 Author Share Posted January 15, 2017 (edited) Correct me because I did not understand anything Edited January 15, 2017 by #_iMr,[E]coo Link to comment
LoPollo Posted January 15, 2017 Share Posted January 15, 2017 --client addEventHandler( "onClientGUIClick", root, function() if source == GUIEditor.button[1] then triggerServerEvent ( "GoToAFK", localPlayer ) --triggerServerEvent ( "UnAFK", localPlayer ) guiSetText ( GUIEditor.button[1], "AFK" ) end end ) --server addEvent( "GoToAFK", true ) addEventHandler( "GoToAFK", root, function() --client is the player whose script called triggerServerEvent exports.voice:setPlayerChannel ( client , 6 ) exports.voice:setPlayerVoiceMuted ( client, true ) --old setPlayerMuted end ) Link to comment
^iiEcoo'x_) Posted January 15, 2017 Author Share Posted January 15, 2017 (edited) Thank's Thank's Thank's Thank's Thank's Thank's Edited January 15, 2017 by #_iMr,[E]coo 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