for i,v in pairs(script.Parent.Parent:GetChildren()) do
v:SetNetworkOwnershipAuto()
end
local VehicleSeat = script.Parent
wait(1)
VehicleSeat.Changed:Connect(function(Property)
if Property == "Occupant" then
local humanoid = VehicleSeat.Occupant
if humanoid then
print(humanoid.Parent)
local player=game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
if player then
print(player)
for i,v in pairs(script.Parent.Parent:GetChildren()) do
v:SetNetworkOwner(player)
end end
else
for i,v in pairs(script.Parent.Parent:GetChildren()) do
v:SetNetworkOwnershipAuto()
end end
end
end)
everything prints up unti lthe line print(humanoid.Parent)
It is a script that is in a car vehicle seat and to prevent lag someone has told me to set ownership and so to test out if the script works, i decided to plant some print commands to see if conditions meet but apparently it gets stuck in the line that says if player then
much help appreciated ,MSDLF

1 comment
Is this the entirety of the script? if so it'll run once. You should only set network ownership when the occupant changes.