Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

SetNetworkOwner not working as described?

Asked by 7 years ago
Edited 7 years ago

I am trying to create a game that uses projectiles. I'm using SetNetworkOwner(nil) to try and remove the "hops" described on the network ownership page. However, even when I am using SetNetworkOwner(nil), the "hops" still happen. What gives?

Code

01function spell:Fire(player, mousePosition)
02    local projectile = part:Clone()
03    local start_position = player.Character:FindFirstChild("Wand").Handle.Tip.WorldPosition
04    local angle = (mousePosition - start_position).unit
05 
06    projectile.Position = start_position
07    projectile.BodyForce.Force = Vector3.new(0, 180, 0) * projectile:GetMass()
08    projectile.Velocity = angle * 150
09    projectile.Origin.Value = player -- originator player, userdata
10    projectile.Parent = workspace
11 
12    projectile:SetNetworkOwner(nil)
13    spell_fired:FireAllClients(projectile)
14 
15    projectile.Touched:Connect(function(part)
View all 22 lines...

I also have a client-side script that handles visual effects if that makes any difference.

0
can you include the other parts of the code User#5423 17 — 7y
0
I have added the other parts now. NotInventedHere 158 — 7y
0
Okay, I have tried changing the places of the lines around, I have tried disabling the new physics solver, but nothing seems to have changed the issue... NotInventedHere 158 — 7y
0
Tried setting the network owner to the player instead, this time the player's physics do not lag but for other players it does. NotInventedHere 158 — 7y
0
THIS QUESTION NEEDS AN ANSWER nc2r 117 — 4y

Answer this question