Trying to attach a car to a trailer

I am currently trying to attach a car to a trailer using code from a towing script Here So far I have looked everywhere and tried everything but I can get it. Here is the code (Just a snip of where it is used since everything else works):

local playerped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerped, true)
local trailer = GetVehicleTrailerVehicle(vehicle)

   AttachEntityToEntity(targetVehicle, trailer, GetEntityBoneIndexByName(trailer 'misc_a'), 0.0 + xoff, -1.5 + yoff, 0.0 + zoff, 0, 0, 0, 1, 1, 0, 1, 0, 1)

you are trying to use a variable that is not created called targetVehicle

It is created, I just don’t want to post the full code since it’s not mine, it’s from the script that I linked above, everything is the same but that one part.

well, do you get any errors?

None, zero
/20 characters