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 6 years ago
Edited 6 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

function spell:Fire(player, mousePosition)
    local projectile = part:Clone()
    local start_position = player.Character:FindFirstChild("Wand").Handle.Tip.WorldPosition
    local angle = (mousePosition - start_position).unit

    projectile.Position = start_position
    projectile.BodyForce.Force = Vector3.new(0, 180, 0) * projectile:GetMass()
    projectile.Velocity = angle * 150
    projectile.Origin.Value = player -- originator player, userdata
    projectile.Parent = workspace

    projectile:SetNetworkOwner(nil)
    spell_fired:FireAllClients(projectile)

    projectile.Touched:Connect(function(part)
        self:Hit(projectile, part)
    end)

    delay(self.Lifetime, function()
        self:Fizzle(projectile)
    end)
end

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 — 6y
0
I have added the other parts now. NotInventedHere 158 — 6y
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 — 6y
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 — 6y
0
THIS QUESTION NEEDS AN ANSWER nc2r 117 — 4y

Answer this question