Changing vehicle livery through a command

I remember seeing another similar topic on here about his command found here but I don’t know enough about development to be able to create a script with it. Anyone that would be willing to help me out?

https://runtime.fivem.net/doc/reference.html#_0x60BF608F1B8CD1B6

--CLIENT
RegisterNetEvent('VehicleLivery')
AddEventHandler('VehicleLivery', function()
	local Veh = GetVehiclePedIsIn(GetPlayerPed(-1))

	SetVehicleLivery(Veh, livery) --CHANGE livery(id)
	SetVehicleExtra(Veh, extraId, toggle) -- CHANGE extraId, toggle(true/false)
end)

--SERVER
AddEventHandler('chatMessage',function(player, playerName, message)
	local msg = string.lower(message)
	
	if msg == '/livery' then
		TriggerClientEvent('VehicleLivery', player)
		CancelEvent()
	end
end)

Thanks, but is there something that I’m missing. I assume I have to add a command for the components but do I need to edit the livery command? Currently doing /livery changes the vehicle livery to 1 but then gets stuck.

https://runtime.fivem.net/doc/reference.html#_0x2BB9230590DA5E8A

Same thing happens with me. How do I fix? @itshb