Im confused. Network Ownership can only be assigned on server to Unachored parts, not the opposite. Or am I wrong?
Why changing the network ownership for parts that are not going to move and have physics as achored parts are?
For the code on the server script well make sure the edit the maxforce of the body velocity, not enough force for a heavy submarine with gravity and it’ll of course not move:
MaxForce Determines the limit on how much force that may be applied to each axis
if you want to control it locally give the model to the player using network ownership for each of the base parts through this function:
local function giveModelToPlayer(model, owner)
local descendants = model:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("BasePart") then
descendant:SetNetworkOwner(owner)
end
end
end
I’m not sure if you have to set the network ownership of all the parts or just the root part documentation doesn’t seem too clear but yeah for now I’ll just set the network ownership to all the parts.
I think the issue here might be that you’re not giving enough force to the BodyVelocity.
Have you tried increasing the velocity, or ensuring that the MaxForce or Poweron the BodyVelocity is enough to move the entire submarine? (pretend this paragraph is strike-throughed, I don’t know how to do that)
Above paragraph was already answered by the post above, the stuff below is still important though.
If you want to have the submarine always move forwards (which it looks like you’re trying to do with the vector variable), you should do this
That means the LookVector for the root part is facing to the right, i.e. the part is rotated 90 degrees. You can either realign the part so the LookVector is facing forwards, or just find which face is facing forwards and use that vector instead (wouldn’t recommend this as its very unintuitive and will make your code unnecessarily confusing)
You can also substitute 10^10 for math.huge (“a value larger than or equal to any other numerical value”), which will make the MaxForce essentially infinite
And then create a new BodyVelocity which will keep the submarine’s velocity on the Y axis constantly at 0 (this shouldn’t be touched by the scripts, create this in studio and with these properties)
MaxForce = Vector3.new(0, math.huge, 0)
Velocity = Vector3.new(0, 0, 0)
P = 9000 -- maybe change this, might be too much or too little depending on the submarine's weight
Of course, this solution will only work if the submarines are only ever going to move on a flat, 2D plane. If you want to have non-flat terrain for the subs to move around on, you should instead just add barriers around the world border so they can’t fall off.
yes, probably Im totally confuse, sorry. I was just saying that ownership can only be set from server, and for Unanchored parts. Probably we are talking about different topics that I dont understand
You don’t assign NetworkOwnership to the BodyMovers themselves, you assign NetworkOwnership to the parts that contain the BodyMovers. If a player has NetworkOwnership of a part, the BodyMovers can be changed on the client and the changes will replicate to the server because the client has ownership over the part.
Rule of thumb, if the client has control over a parts physics then handle the physics on the client in your code.
ONLY UNANCHORED PARTS CAN HAVE THEIR NETWORKOWNERSHIP SET, AND NETWORK OWNERSHIP CAN ONLY BE SET ON THE SERVER!