#Bug with network ownership

1 messages · Page 1 of 1 (latest)

gloomy lance
#

FIXED

steel canyon
# gloomy lance FIXED

-- Dribble system constants (adjust these values to fit your game)
local CAMANGLE_THRESHOLD = 30 -- Angle in degrees to switch between high/low dribble
local LOW_DR_POWER = 50 -- Dribble force when camera angled up
local HIGH_DR_POWER = 80 -- Normal dribble force
local LIFT_POWER = 15 -- Vertical lift force for high dribble
local MIN_SPEED_FOR_OWNERSHIP = 10 -- Minimum speed before transferring ownership

dribble.OnServerEvent:Connect(function(plr, ball, camangle, direction)
-- Safety checks
if not (ball and ball:IsA("BasePart")) then return end
if ball.Anchored then return end
if typeof(direction) ~= "Vector3" or typeof(camangle) ~= "number" then return end

-- Calculate velocity
local velocity
if camangle >= CAMANGLE_THRESHOLD then
    -- High dribble (slower but with lift)
    velocity = Vector3.new(
        direction.X * LOW_DR_POWER,
        LIFT_POWER,
        direction.Z * LOW_DR_POWER
    )
else
    -- Normal dribble (full power)
    velocity = direction * HIGH_DR_POWER
end

-- Handle network ownership based on speed
if velocity.Magnitude > MIN_SPEED_FOR_OWNERSHIP then
    -- For fast movements, keep server ownership
    ball:SetNetworkOwner(nil)
    ball.AssemblyLinearVelocity = velocity
else
    -- For slow movements, give to client
    ball:SetNetworkOwner(plr)
    ball:ApplyImpulse(velocity * ball:GetMass())
end

-- Reset rolling friction (if needed)
local friction = ball:FindFirstChild("RollingFriction")
if friction then
    friction.Value = Vector3.new(0, 0, 0)
end

end)

steel canyon
gloomy lance
#

thanks

#

it works

steel canyon
gloomy lance
steel canyon
river widget
steel canyon
calm sequoia
steel canyon
calm sequoia