You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to fix a infinite yield glitch that occurred on my npc’s pathfind’s
.2. What is the issue? Include screenshots / videos if possible!
So basically, when you join to the game, the npc tracks you and he kills you and everything is going perfect until you respawn, that is where our infinite yield occurs, and what it does is that ones you respawn, as I stated before, the npc lost your track and does not has an specific amount of time to find once again the children, so it can take 30 seconds to find you, 50 seconds, 2 seconds, 600 seconds, well you get the idea. And once it finds you again, and it kills you, it regenerate that infinite yield, and it can take and infinite amount of time, or unknown amount of time to find you once again.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
**After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
What I have tried before is to put an amount of time to the scrip, what I am meaning is take off the infinite yield with a time limit, that way there is no infinite yield, but once I do it, the scriot is still working the same, (Thing that I am going to show later) and again; any script I try to do does not work, does not fix it, and just does nothing besides move things I shouldn’t move. So I am wondering what I have to do.
-- This is an example Lua code block
local hum = script.Parent:WaitForChild(‘Humanoid’)
local hrp = script.Parent:WaitForChild(‘HumanoidRootPart’)
local preVel = nil
if preVel ~= nil then
if math.acos(hrp.Velocity:Dot(preVel)/(hrp.Velocity.Magnitude * preVel.Magnitude)) == math.acos(hrp.Velocity:Dot(preVel)/(hrp.Velocity.Magnitude * preVel.Magnitude)) then
if math.acos(hrp.Velocity:Dot(preVel)/(hrp.Velocity.Magnitude * preVel.Magnitude)) >= math.rad(30) then
hum.WalkSpeed = 24/(math.acos(hrp.Velocity:Dot(preVel)/(hrp.Velocity.Magnitude * preVel.Magnitude))+1)
hum.WalkSpeed = 24
preVel = hrp.Velocity