How to use SetNetworkOwner() for a laser system

So I am trying to make a magic laser blast that updates the end position of the end of a beam constantly (from the player) using the mouse. Using RemoteEvents is NOT good for this and I’m told to use NetworkOwnership, how would this be done?

What I want to know is, how would this be done? Isn’t network ownership only good for physics rendering and how would it be used to update the laser?

I know we aren’t supposed to ask for code, but I learn with excellency by example. At least a starting point would be nice.

1 Like

I’m not really sure what the Laser does that needs a lot of phsysics but NetworkOwnership of a part makes all things be calculated whitin the player’s client then the client gives the data to the server for it to replicate, this is why stuff like NoClipping is possible for cheaters, because they have NetworkOwnership of the character

1 Like

I was looking at this

1 Like

I’ve updated the first sentence in my OG post:

“So I am trying to make a magic laser blast that updates the end position of the end of a beam constantly (from the player) using the mouse.” I apologize for lack of clarity.

Okay i see now, i’ve never used Network Ownership for that but i suppose you could change it whitin a Local Script and it will replicate to the server, but i may be wrong

1 Like

It cannot be used within a localscript unfortunately.

1 Like

Do you mean like a Kamehameha? Imagine that the end point is a sphere, and you’re adding a linear force to it, while mouse controls it’s direction. Set the sphere NetworkOwner to player. You can also add a trail to visualize it.

Could you elaborate and/or provide a script example of that?

And a linear force might not be enough to go through a wall.

I’d like to ultimately achieve this: (not sure why it did an audio file)

1 Like

Fixed. Not sure why it did an audio file

I meant giving the player ownership in the server then trying to modify it locally, by the means of a remote function maybe so you can return the instance with ownership

but does the modification also allow for setting the position?

I imagine so since you can even set the humanoid state of NPC to dead as long as you get the ownership

I think I’ll just use remoteevents…

My attempts at setting network ownership have been unsuccessful w/ no errors

Remote events do work and can be used quite rapidly it’s just not frame by frame and slower with higher players

Figured it out. It’s a matter of making sure the part is unanchored, raycasting mouse position and updating the part cframe as long as the player has its network ownership.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.