Dodgeball Throwing not working

Hey,
I’m trying to make a realistic dodgeball throw but after a few throws its like it loses strength. I’m pretty sure its a client replication problem because its sometimes delayed.
robloxapp-20250203-2136024.wmv (5.1 MB)

Sometimes it will also play the throw animation but then the ball will drop to the ground like nothing happened then a second or two later go in the direction I clicked but not upwards. The throw gets delayed and less accurate every throw. Thanks for any help.

Server Script

local ThrowBallRm = game.ReplicatedStorage.BallRemoteEvents.ThrowBall

ThrowBallRm.OnServerEvent:Connect(function(plr, mousePosition)
	task.wait(.05) -- This wait is so that the ball is thrown at the height of the animation
	local character = plr.Character
	if character.Dodgeball:FindFirstChild("BallWeld") then
		character.Dodgeball.BallWeld:Destroy()
		print("Destroyed")
	end
	
	
	local ballPosition = character.Dodgeball.Position
	local direction = (mousePosition - ballPosition).Unit
	
	local impulseMultiplier = 400
	local impulse = direction * impulseMultiplier
	
	
	character.Dodgeball:ApplyImpulse(impulse)
	character.Dodgeball.Parent = workspace
	task.wait(1) -- This wait is so that the ball isn't immediatly picked back up when thrown
	
	character.HasBall.Value = false


end)

Local Script

local cas = game:GetService("ContextActionService")

local localPlayer = game.Players.LocalPlayer
local character = localPlayer.Character


-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local throwAnimation = Instance.new("Animation")
throwAnimation.AnimationId = "rbxassetid://102875433184499"

-- Load the animation onto the animator
local throwAnimationTrack = animator:LoadAnimation(throwAnimation)



local throwBallRM = game.ReplicatedStorage.BallRemoteEvents.ThrowBall




function throwBall(actionName, inputState, inputObject)
	local mouse = localPlayer:GetMouse()
	
	if inputState == Enum.UserInputState.Begin then
	throwBallRM:FireServer(mouse.Hit.Position) -- Sends mouse position to server
		-- Play the animation track
		throwAnimationTrack:Play()
	end
end


function chargeBall(actionName, inputState, inputObject)
	if inputState == Enum.UserInputState.Begin then
	game.Players.LocalPlayer.Character.Humanoid.Health += 10
	end
end

local ThrowKeybinds = {
	Enum.UserInputType.MouseButton1,
	Enum.KeyCode.ButtonR2
}

local ChargeKeybinds = {
	Enum.UserInputType.MouseButton2,
	Enum.KeyCode.ButtonR1
}



character:WaitForChild("HasBall"):GetPropertyChangedSignal("Value"):Connect(function()
	print("Changed")
	if character.HasBall.Value == true then
		cas:BindAction("ThrowBall", throwBall, true, unpack(ThrowKeybinds)) -- Throwing
		cas:BindAction("ChargeBall", chargeBall, true, unpack(ChargeKeybinds)) -- Charging
	else
		print("unbind")
		cas:UnbindAction("ThrowBall")
		cas:UnbindAction("ChargeBall")
	end
end)


Force = Mass * Velocity or something-
local impulse = direction * character.Dodgeball:GetMass() * impulseMultiplier

Otherwise the way you describe the stuttering sounds like network replication stuff. You could try forcing the network owner to be the server or client (server recommended from a security perspective, otherwise i can just TP the dodgeball to be inside a players head :slight_smile:)