[Problem] chatMessage problem not show message

Hello FiveM users, i have a problem with my script specifically with the chatMessage’s that does not show the messages in the chat box.

this is my script:

local LIP = require 'LIP'

local Logged = false
local Registered = false

AddEventHandler('playerConnecting', function(name)

    if exists(''..name..'.ini') == true or ok then
    	--local data = LIP.load("Gabox0242.ini")
    	Logged = true
    	
    	print('( '..name..' ) Tiene datos guardados en el servidor')
    	
    	print('( '..name..' ) datos cargados')
    else
    	
		print('( '..name..' ) No tiene datos guardados en el servidor, creando...')
		local newdata =
		{
			UserData
			{
				Money = 0,
				Name = name,
				Permissions = 0,
				Banned = false,
				Bannedreason = none,
				Job = 0,
				Car1 = 0,
				Car2 = 0,
		    },
		};
		LIP.save(''..name..'.ini', newdata)
		print('( '..name..' ) Datos creados exitosamente!')
		Registered = true
	end
end)

AddEventHandler("playerSpawned", function(spawn)
	if Logged == true then
		TriggerEvent('chatMessage', '', { 0, 0, 0 }, 'Bienvenido de nuevo!')
	end

	if Registered == true then
		TriggerEvent('chatMessage', '', { 0, 0, 0 }, 'Bienvenido a Metrópolis RolePlay')
    	TriggerEvent('chatMessage', '', { 0, 0, 0 }, 'Hola! vemos que eres nuevo en el servidor')
    	TriggerEvent('chatMessage', '', { 0, 0, 0 }, 'Si en algún momento necesitas ayuda puedes usar el comando /ayuda')
		TriggerEvent('chatMessage', '', { 0, 0, 0 }, '')
		TriggerEvent('chatMessage', '', { 0, 0, 0 }, 'Ya se ha creado tu cuenta automáticamente.')
	end
end)

function exists(file)
   local ok, err, code = os.rename(file, file)
   if not ok then
      if code == 13 then
         -- Permission denied, but it exists
         return true
      end
   end
   return ok, err
end

Everything work except the chatMessage’s help me please, thanks in advance.

What the “ok” means?

Maybe you means “False”!?

1 Like

The ok is for the function

function exists(file)
   local ok, err, code = os.rename(file, file)
   if not ok then
      if code == 13 then
         -- Permission denied, but it exists
         return true
      end
   end
   return ok, err
end

of the return ok.
But I’ll try putting False to see if works
And I’ll tell you if it works by removing the ok

Still not working :frowning:

chatMessage is a client event, not a server event. Try TriggerClientEvent.