How to change a key pressed for a command in chat?

I want to put this to work using /hello in the chat, I tried several ways, however, the ideas I had in mind of how to do, did not work, I am very grateful for who helps me

Citizen.CreateThread(function() 
    while true do
        Citizen.Wait(0)
        
        if IsControlJustPressed(1, Keys['K']) then
            SendNUIMessage({
                control = 'k'
            })
        end
    end
end)
1 Like
RegisterCommand("hello", function()
    SendNUIMessage({
        control = 'k'
    })
end)
2 Likes

Thank you dude, solved !!

1 Like