I’ve got this mount that I give the client network ownership over so they can control it.
The mount is an assembly I move via a BodyVelocity & AlignOrientation entirely on the client.
When it makes a collision with an object controlled by the server or another player causing the assembly’s to intersect (because of network delay) resulting in the assembly jumping up out of the other one. About 10% of the time when this happens the server will re take control of the assembly leaving the client no way to control it.
My guess is roblox has some sort of anti-cheat in place to prevent clients from abusing the moving around of unanchored parts when given ownership.
I’ve thought about moving the entire control to the server, but that would result in input delay. Additionally I’ve thought about having a script on the server constantly check for when the network ownership is taken back and give it back to the client whenever that happens, but that seems like a band-aid patch.
Is there anything I can do to guarantee the server won’t re-control the assembly?
Ran a find on all scripts, and this is the only one where I set network ownership.
--[[
Only called once the player gets initial control of the vehicle.
--]]
function Vehicle:BeginControl()
-- Sets the network owner of all parts to the player
self.Model.HumanoidRootPart.Anchored = false
for _, desc in ipairs(self.Model:GetDescendants()) do
if desc:IsA("BasePart") then
desc:SetNetworkOwner(self.Owner)
end
end
end
Not sure why it disappears for a second, but when it does running a command lets me know that the server took over network ownership.
I’m guessing there’s no chance those dummys could be triggering a touched event that looks for humanoids, and that’s messing with things?
Guessing not. I’m assuming the vehicle is all a single mechanism. In that case, you don’t need to set the ownership of every part—just changing one part will automatically change it for all parts in the mechanism:
Setting ownership on an assembly that has no anchored parts anywhere in the mechanism will set the ownership of every part in the mechanism.
—Network Ownership
So instead of looping through every part, try choosing a single canonical part to change (maybe the same part which has the BodyVelocity).
Maybe this simpler option will cause roblox to freak out less.
Ah found the issue, in those rare occasions my orientation code will assign a NaN to the AlignOrientation instance. Apparently that causes the server to take ownership. Maybe I’d be nice if roblox would provide an error when that occurred so It’s easier to debug.
I appreciate your help, you made me question an area of my code I wouldn’t have considered checking otherwise. Tysm <3
I had the same problem, when I changed the pet position on the server, the network ownership was set to the server for 5 seconds and then back to the client. It was correct a week ago, I didn’t modify the relevant code, this problem occurred in the test today