after sitting on a vehicleseat which is connected to another vehicle and then pulling a tool out, the entire vehicles network gets set to the client, any idea on how i can fix this ( without setting the network again )
set network owner to nil once, it will prevent clients from obtaining ownership
was already set to nil before as i said it happens when a player sits on a vehicleseat and pulls out a tool
odd, does every part in the vehicle have net owner set to nil
yeah im checking the networkos through “Are Owners Shown”
for _, descendant in ipairs(vehicle_1:GetDescendants()) do
if descendant:IsA(“BasePart”) then
descendant:SetNetworkOwner(nil)
end
end
add this too
part:SetNetworkOwnershipAuto(false)
also ipairs and pairs are useless now
nah that didn’t fix it neither its weird
I don’t have a repro place but I would try messing with RootPriority, if this is due to the Tool taking precedence over your vehicles then this could be worth looking into.
If anyone’s curious, here’s what I ended up doing to make it work:
Once a player sits on the chair, I temporarily move their tools from their Backpack into a folder inside Workspace (since network ownership can only be controlled on parts that are descendants of Workspace). Then, I set the network ownership of all the tool parts to the server, and finally, I move the tools back into the player’s Backpack.
If anyone has a better solution, please share it — I’m not marking this as the final solution yet.
Occupant Code :
seat:GetPropertyChangedSignal('Occupant'):Connect(function()
local player = players:GetPlayerFromCharacter(seat['Occupant']['Parent'])
if not player or not player['Character'] then return end
--// here we move all the parts to temp_storage folder
for _, v in ipairs(player['Backpack']:GetChildren()) do
if v:IsA("Tool") then
v['Parent'] = work_space['temp_storage']
end
end
--// here we search through temp_storage folder and do the rest
for _, v in ipairs(work_space['temp_storage']:GetChildren()) do
if v:IsA("Tool") then
for _, part in ipairs(v:GetDescendants()) do
if part:IsA("BasePart") then
part:SetNetworkOwnershipAuto(false)
part:SetNetworkOwner(nil)
end
end
v['Parent'] = player['Backpack']
end
end
end)
You also need to do this for any new parts added to the player’s character or Backpack while they’re seated by just doing work_space.DescendantAdded:Connect(function()
. No need to worry about resetting network ownership after the player leaves the seat because it will automatically revert to the player once they get off.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.