Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Zombie:GetClosestTarget()
- local Target = self.Target
- for _, Player in next, Players:GetPlayers() do
- local Torso = Player.Character:FindFirstChild("Torso")
- local Distance = (self.Root.Position - Torso.Position).magnitude
- if Target then
- if Distance < (self.Root.Position - Torso.Position).magnitude then
- Target = Player.Character
- end
- else
- Target = Player.Character
- end
- end
- self.Target = Target
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement