So I am almost done with my Clown van kidnap remake.
One feature of the clown van is that it always comes from the left of the player, no matter where they are.
So far, I can only get the van to come correctly toward the target humanoidroot, only when I am facing the same direction.
I basically want to make it so no matter where the player faces, the van will always come from the players left and will always be on a logical angle for a car to move
If you use the negation of the RightVector of the player’s humanoid root part
(-Player.Character.HumanoidRootPart.CFrame.RightVector), then spawn the van at some multiple in that direction, for how far away it should spawn, you should be able to get it to show up where you want. Note that using just the negative RightVector will cause it to be in line with the player, so you may wish to make use of the FrontVector too, so you can move the van a some number of studs in front of the player.
(does that make sense? It’s a big block of text )
So I just looked up these vectors. In this case, these vectors would basically “change” with the humanoidrootpart, so no matter the orientation of the part, it would still always come from the same side, instead of being locked on a fixed cframe?
That means that the right vector of the player is entirely in the X direction. If you were to turn 90 degrees clockwise, it would be come (0,0,1), and for all other values it would move between, having the magnitude of the vector always being 1.
Yeah correct. so what my script does right now is it spawns 50 studs away and when it spawns, it moves on the x axis until the X coordinate of the humanoidroot and the primarypart of the van are close enough.
while task.wait(0.1) do
local position = primary.CFrame
local newposition = position + Vector3.new(2,0,0)
local tween = ts:Create(primary, tsinfo, {CFrame = newposition})
tween:Play()