|
| 29 Jul 2015 03:01 PM |
I want to do this so I can use BodyGyros to rotate the NPC's head towards the player nearest to it. if siggy == false then print"nooo :(" end |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2015 05:23 PM |
b if siggy == false then print"nooo :(" end |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 29 Jul 2015 05:35 PM |
lets start by getting closest person.
AI = script.Parent tor = AI.Torso bodygyro = AI.Head.BodyGyro local folder = Instance.new("Folder", game.Workspace) folder.Name = "Folder";
while wait(1) do local tab = {} for i,v in pairs(game.Players:GetPlayers()) do wait() table.insert(tab, (v.Character.Torso.Position - tor.Position).magnitude) end table.sort(tab); local closest = tab[1]--least to most, 1st will be least, therefore closest local closestPLR for i,v in pairs(game.Players:GetPlayers()) do wait() if (v.Character.Torso.Position - tor.Position).magnitude == closest then closestPLR = v; bodygyro.cframe = CFrame.new(AI.Head.Position, closestPlr.Head.Position) end end end
tell me if that works |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 29 Jul 2015 05:41 PM |
@OP
put a danm space between what you say and your siggy. ffs
"Talk is cheap. Show me the code." - Linus Torvalds |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 29 Jul 2015 06:07 PM |
| Jerk^ dont listen to him hes mean |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2015 08:57 PM |
I dont like having to press enter every time... like this
if siggy == false then print"nooo :(" end |
|
|
| Report Abuse |
|
|