Client-server connection

Okay, so, in client-side i have a command what triggers a server event.

Server event code:

AddEventHandler(“carcommand:isadmin”, function(source)
TriggerClientEvent(“eventName”, source, “test”)
end)

The client event code:
RegisterNetEvent(“eventName”)
AddEventHandler(‘eventName’, function(text)
print(“received”)
end)

When i do the command, it successfully triggers the server event, but after that the client event wont trigger.
There’s no errors.

How im triggering the server event:
TriggerServerEvent(‘carcommand:isadmin’, PlayerPedId())

Am i doing something wrong?

You do not need to send the client id to the server. The server knows who the source is once it recieves the event from the client.

You do not need to have source listed in the function part of the register for the server side.
Dont pass it from the client either.

When posting code in future please use codeblocks like I have below.


--Server event code:
AddEventHandler(“carcommand:isadmin”, function()
local src = source
TriggerClientEvent(“eventName”, src, “test”)
end)

--The client event code:
RegisterNetEvent(“eventName”)
AddEventHandler(‘eventName’, function(text)
print(“received : ”..text)
end)

--The Client calling the Event
TriggerServerEvent(‘carcommand:isadmin’)