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 wan’t to achieve to improve the infinity yield glitch that occurs on an npc acceleration path find which disturbs all the game.
- What is the issue? Include screenshots / videos if possible!
So once you join the game, the NPC pathfinder can find you because the glitch doesn’t occur yet, and everything is going precisely, but once it kills you, and you respawn, the NPC does not track you, or find you immediately, so it stays still, because, on its acceleration script, it doesn’t tell him to find you once again, so after you are dead, because there is an infinity yield and it can wait for 3 whole hours until it finds you, because is an unknown number.
Here is a video of what happens on the game:
Here is a photo of the script:
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
What I tried before
What i tried before is change the script and add an amount if time to it but nothing happened, and the infinity yield still occurred.
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!
-- This is an example Lua code block
local hum = script.Parent:WaitForChild(‘Humanoid’)
local hrp = script.Parent:WaitForChild(‘HumanoidRootPart’)
local preVel = nil
hum:GetPropertyChangedSignal(‘WalkToPoint’):Connect(function()
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)
else
hum.WalkSpeed = 24
end
end
end
preVel = hrp.Velocity
end)