I’m making a jojo game but the stands are lagging the game, I’m trying to find out whats causing lag, so i need to know if this is what causes it.
--server script
repeat wait() until script.Parent.Anchored == false
script.Parent:SetNetworkOwner(player)
while wait() do
if script.Parent.Anchored == false then
script.Parent:SetNetworkOwner(player)
end
end
if it does cause it, is there another way i can do this without any lag??
You could use the Script Performance tab and check the activity and rate there.
below 2-3% activity you’re good.
you don’t have to use SetNetworkOwner multiple times on the same part for the same player.
Make sure you have used it once on the right player. Don’t make an infinite loop to do this.
Yes it will cause “lag” (though not network-latency “lag”), because it is not optimal code. It looks like a “band-aid” for an issue that should not be there.
Why do you need to wait for the Anchored-property to become false?
The only thing that could change that Anchored-property, is your own script-code on the server.
So instead of that “anti-pattern” code you posted, it would be much better to change the network-owner where you also change the Anchored-property.