Howdy
https://gyazo.com/f75ebcded6b1f73e745d32c60fb1120a
(left is server, right is client)
i’ve been having issues with NPCs chasing players, my npcs chase just fine on server and are where i want them to be and even damage the player however on client they lag noticeably behind.
things i’ve tried
-setting network ownership to nil, once, every few seconds, every single part on the npc, nothing seems to work
-removing everything but the chase script (same stuff)
-lots of googling
im open to any solutions at this point im kinda lost
local function main(AI, Root, torso, humanoid)
local target = findTarget(AI, Root)
if target then
if checksight(humanoid,Root,AI,target) then
humanoid:MoveTo(target.Position - CFrame.new(Root.Position, target.Position).LookVector * -5,target)
--humanoid:MoveTo(target.Position + target.AssemblyLinearVelocity,target)
--targetPosition,shooterPosition,targetVelocity,projectileSpeed
if findDist(target,Root) < 6 then
if not AI:GetAttribute("attack_cooldown") then
task.spawn(function()
AI:SetAttribute("attack_cooldown",true)
attack(target,Root,humanoid,AI)
end)
end
end
else
pathToTarget(AI,Root,humanoid,target)
end
else
if not AI:GetAttribute("wander_cooldown") then
AI:SetAttribute("wander_cooldown", true)
walkRandomly(AI,Root,humanoid)
task.delay(2, function()
AI:SetAttribute("wander_cooldown", false)
end)
end
end
end
(code)