PERP Player:RemoveCar help!

Hello, I am working on a NPC code to remove the players car when requested. When the player clicks “I would like to store my vehicle in the garage.” I want the car to just disappear from the map and then the player would be able to spawn another one in with no problem… I have some of the code down but I need some help to fix it. It doesnt give me any lua errors and the dialog box with the NPC disappears like its supposed to but the vehicle doesnt. Please help!



function NPC.RemoveCar ( Player )
	for k, v in pairs(ents.GetAll("prop_vehicle_jeep")) do
		if (v.Owner && v.Owner == Player) then
			v:Remove();
		end
	end
	LEAVE_DIALOG();
end


Hi,
I just started to learn lua language with gmod API, so here is what I think:
Maybe you didn’t give Owner variable a value when the vehicle spawn, check in the code where you create the vehicle if you did something like that :


v.Owner = Player

Didnt work dude.

Why not use ply.Car = v when you spawn the vehicle, then ply.Car:Remove() when you remove it?

Cant, because Car is not a valid value. Its recognized as a nil value.

Do you work for Killslick?

You seem to fill out the resume he looks for…

lol, perp.

You can’t expect the vehicle to be removed clientside.

No I dont work for KillDick, or DickSlick.

I personally favor “ShitSlick”.

What you are looking for is basic Lua knowledge. You need that before you can do this.