So I’m making a pathfinding AI and got my friend to help me with testing it. The ai sets network ownership to it’s target to make the ai as smooth as possible but when the target lags, the ai also starts to lag and or completely freeze until network ownership is changed. I tried GetNetworkPing() but that returns an inaccurate ping even when multiplied by 1000 or 2000. How would I check if a player is lagging or not from server?
Please can someone help this is issue
So you are setting the network owner to the target (player)?
I think you should try setting it to nil, like this: HumanodRootPart:SetNetworkOwner(nil)
.
HumanodRootPart
is the root part of your NPC.
This could probably fix the lagging issue.
ping is network lag that usually doesn’t affect the FPS of a player, idk if there a function for getting FPS but you can create your own FPS function by simply getting the deltatime for each runservice heartbeat call, the deltatime is the number of seconds passed per frame (this will involve having a local script firing remotes)
:GetNetworkPing() isss tooooo epiiiiic
When I do that, the AIs hitbox is much larger than intended. Resulting in the game being very hard to play as there are a lot of hallways and small rooms in the maps. I am trying to figure out a way to set the network owner to nil if the players ping is high
https://developer.roblox.com/en-us/api-reference/function/Player/GetNetworkPing
I cannot test this function rn but do you think you could show us a sample print of a player’s ping?
My actual ping:
What GetNetworkPing() returns:
This is in both studio and in game.
After some research I believe the function GetNetworkPing() is not complete for whatever reason, plenty of posts saying it returns 0 for no reason, I also tested and it returns 0
a workaround:
Thanks so much! I have been stuck on this issue for a while now!