Making Notifications Clientsided

How do I get the notification to instead be clientsided and not let everyone see it. Heres my code:

Client:

RegisterNetEvent('showNotify')

AddEventHandler('showNotify', function(notify)
	ShowAboveRadarMessage(notify)
end)

function ShowAboveRadarMessage(message)
	SetNotificationTextEntry("STRING")
	AddTextComponentString(message)
	DrawNotification(0,1)
end

Server (example)

AddEventHandler('chatMessage', function(source, n, msg)
   msg = string.lower(msg)
   if (msg == "/n") then
      CancelEvent()
      TriggerClientEvent('showNotify', -1,"~b~Test")
   end
end)

Just wan’t to test for my other script, but how can I make what the server script is doing clientsided instead?

https://wiki.fivem.net/wiki/GetPlayerFromServerId

RegisterNetEvent('showNotify')
AddEventHandler('showNotify', function(notify, id)
    if PlayerId() == GetPlayerFromServerId(id) then
	    ShowAboveRadarMessage(notify)
	end
end)

function ShowAboveRadarMessage(message)
	SetNotificationTextEntry("STRING")
	AddTextComponentString(message)
	DrawNotification(0,1)
end
TriggerClientEvent('showNotify', -1,"~b~Test", source)

or

RegisterNetEvent('showNotify')

AddEventHandler('showNotify', function(notify)
	ShowAboveRadarMessage(notify)
end)

function ShowAboveRadarMessage(message)
	SetNotificationTextEntry("STRING")
	AddTextComponentString(message)
	DrawNotification(0,1)
end

TriggerClientEvent('showNotify', source,"~b~Test")
1 Like

Thanks! I’ll try it out!