How i can fix that ball is lagging for other players
I set the ball network owner to player cuz if it’s server it’s lagging for players
When i use LinearVelocity ball is lagging for other players but when BodyPosition(for dribble system) it don’t
How it looks for me:
For other players:
Here is script:
ball:SetNetworkOwner(player)
ball:SetAttribute("State","Shoting")
ball.Owner.Value = player.Name
local shotSound = game.ReplicatedStorage.Shot.ShotSound:Clone()
shotSound.Parent = workspace
shotSound:Play()
game.Debris:AddItem(shotSound,2)
local direction
local factor
ball.Attachment.Balls:Emit(50)
ball.Attachment.Lines:Emit(50)
ball.Attachment.Circle:Emit(1)
ball.Attachment.Circle2:Emit(1)
if Power <= 30 then
factor = 5
else
factor = 3.75
end
if arg == "yes" then
direction = dir * Power / 2 * factor
else
direction = HRP.CFrame.LookVector * Power / 2 * factor
end
if direction.Y < 0 then
direction = Vector3.new(direction.X,0,direction.Z)
end
local velocity = Instance.new("LinearVelocity",ball)
velocity.Attachment0 = ball.Attachment
velocity.MaxForce = 2000
velocity.VectorVelocity = direction
local falling
delay(0.4,function()
velocity:Destroy()
canTouching = true
task.wait(1)
if ball.Owner.Value ~= "Neutral" or ball.Owner.Value == player.Name and canTouching == true and ball:FindFirstChild("LinearVelocity") == nil and ball:FindFirstChild("BodyPosition") == nil then
canTouching = false
for i = 1,5 do
ball.AssemblyLinearVelocity = 0.6 * ball.AssemblyLinearVelocity
ball.AssemblyAngularVelocity = 0.6 * ball.AssemblyAngularVelocity
task.wait(0.01)
end
end
end)
Thanks everyone for help and sry for my english