attempt to call a nil value (global 'TriggerClientEvent') FiveM Chatbox

1.8k Views Asked by At

So I bought this script and I cant seem to find any support on it...So Imma need some help here. For reference this script plays a "Typing" Gif above someones head when they type

RegisterCommand("chatbox", function(source, args, rawCommand)
    chatbox = tonumber(args[1])
    if chatbox == 1 then
        TriggerClientEvent('chatbox:ToggleDisplay', -1, source, 1, "chatbox")
    elseif chatbox == 2 then
        TriggerClientEvent('chatbox:ToggleDisplay', -1, source, 3, "chatbox")
    elseif chatbox == 3 then
        TriggerClientEvent('chatbox:ToggleDisplay', -1, source, 2, "chatbox")
    end
end, false)

This is the code that gives me the ClientEvent Error.

if chatInputActivating then
  if not IsControlPressed(0, 245) then
      ExecuteCommand("chatbox 1") -- chatbox 1-3 which one you wanna use
    SetNuiFocus(true)

    chatInputActivating = false
  end
end

This here is the code that activates this when typing in chat (this is placed in the cl_chat.lua in resources/gameplay/chat/)

0

There are 0 best solutions below