I want to make models that spawn have a network owner to perhaps make physics better, however, when I try to do the network owner function on them, it doesn’t work. Any idea why?
local car = game.ServerStorage["Car"]:Clone()
car.Parent = workspace.Cars
car.Name = script.Parent.Parent.Name.."Car"
car:SetPrimaryPartCFrame(script.Parent.Handle.spawn.WorldCFrame)
car.LicensePlate.SurfaceGui.TextLabel.Text = script.Parent.Parent.Name.."'s Car"
car:SetNetworkOwnershipAuto(game.Players:GetPlayerFromCharacter(script.Parent.Parent))
Unfortunately yes. I am not sure why you’d need to set NetworkOwnership of that many parts, but if you do, you’d have to loop through them. When it comes to destruction, it might just be better to handle it on the server instead of setting ownership. Not sure though, that’s a topic for another post.
Well, then you’ll have to figure out the proper way to set ownership. I haven’t really used SetOwnership on this scale before, so I can’t really give recommendations. Regardless, you’ll have to individually set each part unfortunately, unless it is an assembly (no idea what that is), which sets the ownership of every unanchored part by itself. Quoted from the wiki:
I am not quite sure. Roblox does mention something about assemblies, but doesn’t clarify at all. In their example, they only set the NetworkOwnership of the vehicle seat, so that must suggest that everything else also gets set to that. Now, I can’t guarantee you that it works for everything, but you can try it out.
EDIT: I looked at it more, and it seems that an “assembly” is just everything that has been welded together by a WeldConstraint or Motor6D. Read more about assemblies here.
I already tried making it :SetNetworkOwner(game.Players:GetPlayerFromCharacter(script.Parent.Parent)) and :SetNetworkOwner(script.Parent.Parent.Name) and :SetNetworkOwner(script.Parent.Parent.Name)
I also tried to do the network owner on the cloned car.
From the docs:
<code>SetNetworkOwner(player)</code> Assigns this Instance to the player. This is the same thing as using SetNetworkOwnerAuto, except it only works on the server. The player parameter is a Player object. If the player is nil, the Instance belongs to no one.
This means you cannot call this method on the client-side.