Need Help My Event Wont Start

Hello, I will tell you below a story to sleep standing, or not to sleep at all.
Client Side i registered my event :

RegisterNetEvent("entreprise:testclient")
AddEventHandler("entreprise:testclient", function()
	Chat('AH')
end

Needless to say that the function Chat does not exist, I use it higher in my script.
Server side i have :

RegisterServerEvent('entreprise:recupinfos')
AddEventHandler('entreprise:recupinfos', function()
	Testing() -- OK
	print('Testing lancé') -- OK
end)

function Testing()
	TriggerEvent('es:getPlayerFromId', source, function(user)		
		TriggerEvent('es:exposeDBFunctions', function(db)
			db.getDocumentByRow('gta5_entreprise', 'identifier', user.get('identifier'), function(dbuser)
				if(dbuser)then
                    local hasEntreprise = dbuser.hasEntreprise 
                    print(hasEntreprise)
					    local testno2 = "C'est Bon!" -- OK
						TriggerClientEvent('entreprise:testclient', source) -- Don't Work
						print("Test : " ..testno2) -- OK
				else
					print('Erreur')
				end
			end)			
		end)		
	end)
end

Thankssss

Not too sure but, I’m pretty sure “source” only exists for events. If you want it to work in functions, you’re going to have to pass it.

AddEventHandler('entreprise:recupinfos', function()
	Testing(source) -- OK
	print('Testing lancé') -- OK
end)

function Testing(source)
	--- code here
        -- source now exists in the function "Testing"
end

Edit: Also, wrong section. Please try and post in the correct category next time :slightly_smiling_face:

Sure.

I have the same problem when i put the funciton content directly in the server event.
Edit : Not Working

Yea, I’ve updated the snippet as I forgot to add “source” as a parameter for the function…

Edit: It could be because you have like two events inside of each other and, because of the asynchronous nature of events, the “source” variable is being released from memory…

Edit 2: Have you tried just triggering the event from the server event? E.g.

AddEventHandler('entreprise:recupinfos', function()
	TriggerClientEvent("event", source)
	print('Testing lancé') -- OK
end)

I tryed, and it work

That dont work only when i put my function or my trg client event inside the 2 others event
you know x)

IT WORKS DUDE I LOVE U.
Have a good day x)