So Basically Im making a RPG, And the Enemy Script that Moves and finds the Human Is lagging the server, and making it so the enemy's wont play they're animation. here's the script:
while Figure.Parent do
wait(0.15)
local amt = RunService.Stepped:wait()
if amt > nextTime then
move(amt) -- This is quite a big script, so running this takes alot of the script performance every 0.15s
nextTime = amt + .1
end
local Target = findNearestTorso(Torso.Position) -- i need this to auto update
if Target then
Humanoid:MoveTo(Target.Position, Target) -- move enemy towards player
TouchValue.Value = true -- returns to spawn(Seperate script handles this)
end
end
So really, I need this to auto Update. If i made a 'While Target do' Statement that means when the Player (Target) was not There, and he returns to spawn, the animation wont play, if you see what i mean. I Basically need to rework the Code.
P.S If i lower the While tru do statment's wait time, The animations dont play correctly. Sorry about my bad explaining :P
