How to apply network ownership?

I have a ramp in my game where quite a few balls travel down randomly. They didn’t go smoothly down the ramp though, since I noticed the judder when the balls are near to the player because the network ownership changes. I’ve tried adding in this - game.ReplicatedStorage.Ball1:SetNetworkOwner(nil) to my existing server script for ball 1 but nothing changes, it still judders. The balls are in replicated storage.

The ball script is this-
game.ReplicatedStorage.Ball1:SetNetworkOwner(nil)

–// Variables

local ReplicatedStorage = game.ReplicatedStorage

local Ball1 = ReplicatedStorage:WaitForChild(‘Ball1’)

local BallSpawn1 = workspace:WaitForChild(‘BallSpawn1’)

–// Main

while wait(math.random(1,1)) do

local NewBall1 = Ball1:Clone()

NewBall1.Parent = BallSpawn1

NewBall1.CFrame = BallSpawn1.CFrame

game:GetService(‘Debris’):AddItem(NewBall1,7) – The ‘3’ is how many secs it will disappear in.

end

Setting network ownership to nil won’t stop any judders. However, in some cases it might.

well I was just wondering where I might put that line of script in order to make network ownership work.

I think after parenting the Ball

unfortunately that doesn’t work.

The solution @HackItsGood suggested should work

–// Variables
local ReplicatedStorage = game.ReplicatedStorage
local Ball1 = ReplicatedStorage:WaitForChild(‘Ball1’)
local BallSpawn1 = workspace:WaitForChild(‘BallSpawn1’)

–// Main
while wait(math.random(1,1)) do
    local NewBall1 = Ball1:Clone()
    NewBall1.Parent = BallSpawn1
    NewBall1:SetNetworkOwner(nil) -- set network owner after the ball is in workspace
    NewBall1.CFrame = BallSpawn1.CFrame
    game:GetService(‘Debris’):AddItem(NewBall1,7)
end
1 Like

yes that works. thank you for that.

Don’t forget to mark the answer as a solution if you don’t have anymore questions :smile: