[ADVICE]I am working on a script that blacklist cars need some advice with the code!

SO i currently have this code for cars it is not finished yet i needed some advice on what i did wrong or what should i do because this is only my second scripts and i only need advice or help only on this code!

CODE

Citizen.CreateThread(function()
while true do
Wait(1)

	playerPed = GetPlayerPed(-2)
	if playerPed then
		checkCar(GetVehiclePedIsIn(playerPed, true))

		x, y, z = table.unpack(GetEntityCoords(playerPed, true))
		for _, blacklistedCar in pairs(carblacklist) do
			checkCar(GetClosestVehicle(x, y, z, 100.0, GetHashKey(blacklistedCar), 70))
		end
	end
end

end)

function checkCar(car)
if car then
carModel = GetEntityModel(car)
carName = GetDisplayNameFromVehicleModel(carModel)

	if isCarBlacklisted(carModel) then
		_DeleteEntity(car)
		sendForbiddenMessage("you dont have permissions to use this model!")
	end
end

end

function isCarBlacklisted(model)
for _, blacklistedCar in pairs(carblacklist) do
if model == GetHashKey(blacklistedCar) then
return true
end
end

return false

end

move this if it is on the wrong category!