How to take network ownership back when a driver leaves
A driver given SetNetworkOwner keeps simulating the empty vehicle after getting out. How to hand ownership back in the same Occupant handler.
What it looks like
A vehicle script gives the driver network ownership with SetNetworkOwner(player) when they sit in the seat, so driving feels smooth. Nothing hands ownership back when they get out, so the empty vehicle stays simulated by their client.
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
local humanoid = seat.Occupant
local player = if humanoid then Players:GetPlayerFromCharacter(humanoid.Parent) else nil
if player then
seat:SetNetworkOwner(player)
end
end)What an exploiter could do
Roblox's documentation says it can't verify physics on a part a client owns: that client can teleport the part, push it through walls or make it fly, and can fire Touched for it even when the server saw no touch. Once they've stepped out, the last driver can still do that with the empty vehicle from anywhere on the map until someone else sits in it. They can drop it on the spawn, park it in other players' way, ram it into players and their vehicles, or set off anything that reacts to the vehicle touching it.
How to fix it
- Hand ownership back as soon as the seat is empty, in the same
Occupanthandler that gave it out. SetNetworkOwnershipAuto()is what Roblox's own vehicle example uses, and it lets the engine pick an owner again. The engine favours clients whose characters are close, which can still be the last driver while they stand next to it. For vehicles that can hurt players or count towards anything, useSetNetworkOwner(nil)so the server simulates them while they're empty.- If rewards depend on where the vehicle goes, Rewards decided by parts a client simulates applies even while someone is driving.
Vulnerable example
local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local seat = Workspace:WaitForChild("Ferry"):WaitForChild("Helm") :: VehicleSeat seat:GetPropertyChangedSignal("Occupant"):Connect(function() local humanoid = seat.Occupant local player = if humanoid then Players:GetPlayerFromCharacter(humanoid.Parent) else nil if player then seat:SetNetworkOwner(player) end end)
Fixed example
local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local seat = Workspace:WaitForChild("Ferry"):WaitForChild("Helm") :: VehicleSeat seat:GetPropertyChangedSignal("Occupant"):Connect(function() local humanoid = seat.Occupant local player = if humanoid then Players:GetPlayerFromCharacter(humanoid.Parent) else nil if player then seat:SetNetworkOwner(player) else seat:SetNetworkOwner(nil) end end)
How to spot this in your own scripts, and the cases that only look like it, are part of the Luaudit check your AI runs.