How to set the network ownership of all projectiles/bullets on all of the players?

As it says in the title, i want to manage the Network Ownership | Roblox Creator Documentation of a projectile to all the players in the game. However i cant figure out how to do this, any ideas/methods would be appreciated,

I have tried a few methods such as reading a string value with all the players names in it but that still does not work.

I don’t really know how to do this but you can set it to the server by doing

Part:SetNetworkOwner(nil)

I’m pretty sure network ownership can only be granted to a single player
The function is SetNetworkOwner and not SetNetworkOwners

If you want to achieve the functionality you’re looking for, you’d need to have a RemoteEvent that any player can call to set the CFrame of the part. Doing that’s not always the best idea, but I guess it’d depend on your use case.

1 Like

I know that, but the reason I’m trying to set the owner to the players is due to projectile lag when the server manages the projectile. (This post I was covering Projectile "Lag")

What you might be thinking of is having a copy of the bullet on all of the clients. You could either send the bullet to the client through instances (adding instances, adding the bullet to PlayerGUI, changing Value settings) or using RemoteEvents.

For example, you could use RemoteEvent:FireAllClients(bulletInfo). Then on the client you could handle the event by creating a bullet on the client with the bulletInfo.

1 Like

Massive thanks, one question is that is this a optimized way of doing this?

1 Like

It depends how you do it and what you’re trying to optimize.

I read your post, here is what I would recommend:

  • [Client]: Create a cannon ball on the player’s client who activates it
  • [Client]: Send info about the cannon ball with a start time(from a synced timer) and the path
  • [Server]: Calculate where the cannon ball should be (connection/loop based on time and path), raycast/hitbox on the server
  • [Server]: Send the cannon ball info to the other clients
  • [Other Clients]: Calculate on the client where the cannon ball should be at that time (again from a synced timer)

What this does is make the cannon ball be at the correct position for every player and removes the lag for the player who fires it. Other players could see the cannon ball jump a little out of the cannon, but you can handle that with tweening on their clients.

Note: You only fire one remote to each player other than the player who fires. After that, use the sent information to get where the cannon ball should be.


The method above is a little complex. Here is a fairly simple article that talks about lag and firing cannons:

https://developer.roblox.com/articles/Fighting-Against-Lag

7 Likes

I thank you greatly, hopefully this post will get out there and more users suffering from the same issue I face can get help from you, thanks!
:pray: