Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help With Following?

Asked by
Scootakip 299 Moderation Voter
8 years ago
script.Parent.Zombie:MoveTo(v.Character.Torso.Position - Vector3.new(10,0,10) - v.Character.Torso.CFrame.lookVector)

This is a script meant to have the zombie constantly stay 10 studs behind the player, but rather than that it just keep it positive 10 studs away. I thought that throwing the Character's Torso's lookVector in there and having it keep behind the look vector would work but that doesn't help. Can someone help me keep the zombie behind the player's back at all times?

1 answer

Log in to vote
0
Answered by 8 years ago
v.Character.Torso.Position - Vector3.new(10,0,10) - v.Character.Torso.CFrame.lookVector

is going to do the following:

1) get the player's position

2) move over 10 in the x and z directions globally

3) move over 1 stud in the direction of the player

to fix, instead of that second step, just make the third step more pronounced by multiplying the lookVector by ten:

script.Parent.Zombie:MoveTo(v.Character.Torso.Position - 10*v.Character.Torso.CFrame.lookVector)
Ad

Answer this question