Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a Pathfinding Npc Vehicle without Plugins???

I need it in Cframes----


I was thinking about using another Cframe script, make it move the same length as the road, then move it to the other road and make it go that way. And it repeats

1 answer

✓ Accepted answer

If you want an infinite loop parts moving, you have to itirate through the parts if the vehicle and moving them by CFrames and turning around. Something like this:

for i = 1, math.huge do
	for i,v in pairs(VEHICLEPART:GetDescendants()) do -- take the vehicle descendants
		if v:IsA("Part") or v:IsA("UnionOperation") or v:IsA("MeshPart") then --[[ if the descendants is a part or similar]]
			if i <= 20 then -- this is just an example, edit
			v.CFrame = v.CFrame * CFrame.new(1, 0, 0) -- you can edit this
			elseif i > 20 then
			v.CFrame = v.CFrame * CFrame.new(-1, 0, 0) -- also here u can change rotation
			end
		end
 	end
end

Also, this will lag a bit, but if u want it with cframes, i think its the only way to do it.

This discussion is preserved as it was. New answers, comments, and votes are closed.