Projectile lag help

In my basketball game, I’ve been working on a passing system, and it works fine for the most part except projectile lag messes everything up. If you are moving forward and pass the ball, it ends up going behind you because it freezes due to network ownership. Ive tried adding vectors to it to no avail without it looking awful. How would i work around this? Thanks.

Try using client projectiles. Basically

  1. local script(Input)
  2. sever script(fires bindable event)
  3. server script(fires local script)
  4. local script(makes the projectile)

You can set the ball’s network ownership to the server (ball:SetNetworkOwner(nil))

1 Like

i know… thats what the issue is though. it freezes causing it to end up behind me by the time its launched

This doesnt work as the ball is always in workspace. I dont create it everytime i use it.

I made it before and I know it works. Would you like an example?
Ok give me a momment please.

Sure actually. Thanks! (30000)

When things stutter due to network ownership, it’s because the part is switching between being controlled by the server & client(s). And if you run this line of code then the part (or ball) will always be on the server and won’t be changed to the client. If that doesn’t work then it’s probably not due to network ownership?

It has to be changed to the player when the given character has the ball so things such as dribbling work.

So the network owner is switched to whoever is holding/dribbling the ball?

Well I don’t know you scripts exactly therefore, I will just guess.
Basically Input:

local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local character = player.Character or player.CharacterAded:Wait()
local Connector = game:GetService("ReplicatedStorage"):WaitForChild("ConnectorEvent")

mouse.Button1Down:Connect(function()
   if character:FindFirstChild("Ball") then
       Connect:FireServer()
    end
end)

Connect:

local Connector = game:GetService("ReplicatedStorage"):WaitForChild("ConnectorEvent")
local Visual = game:GetService("ReplicatedStorage"):WaitForChild("FireEvent")
Connect.OnServerEvent:Connect(function(player)
   Visual:FireAllClilents(player)
end)

Visual:

local Visual = game:GetService("ReplicatedStorage"):WaitForChild("FireEvent")
Visual.OnClientEvent:Connect(function(player)
   --Shoot
end)

Sorry I made this in a rush and I have to go now sorry.

Yes thats how it works. (3000)

Ill look into this. Thank you.

Easiest way that I would go about it is, to only render balls on the client, create one when you throw the ball, and then tell the server to tell the other clients that you threw a ball, and they create one too.

The only problem with this is you can’t do client to server to client you have to do client to server to server to client.

Is there any difference? I’ve used this for all of my first person shooters, the difference would be disregard able for using it with a basketball as well, they are both projectiles as far as I’m aware?

1 Like

Hmm maybe before I did something different? From my past experience I wasn’t able to do that, the output stated could not Fire Client, something like that. But, thanks for telling me now hopefully I can make an easier system.

Set network ownership of the ball to the ball’s holder.

You have to FireServer(projData) on the client and then on the server FireAllClients(projData)

1 Like

It seems like you are using a-lot of loops in your game/script. Instead, try using tweenservice. TweenService | Roblox Creator Documentation