Why is my ball so laggy?

So, I have this throwable ball but it’s seems to move fairly choppily at the beginning, does anyone know why?

robloxapp-20210518-1606302.wmv (536.6 KB)
(converting this to an mp4 wrecked the video itself for some reason that’s why I kept is as a wmv)

--Event Variables
local fPressed = script.Parent:WaitForChild("FPressed")

--Asset Variables
local handle = script.Parent:WaitForChild("Handle")

local function onServerEvent(player)
	local char = player.Character
	local newBall = handle:Clone()
	newBall.CFrame = char.HumanoidRootPart.CFrame
	
	local anim = Instance.new("Animation")
	anim.AnimationId = "rbxassetid://6831445023"
	local animTrack = char.Humanoid:LoadAnimation(anim)
	animTrack:Play()
	animTrack.Stopped:Wait()
	
	local bodyVel = Instance.new("BodyVelocity")
	bodyVel.MaxForce = Vector3.new(5000, 1000, 5000)
	bodyVel.Velocity = (handle.CFrame.LookVector * 100)
	bodyVel.Parent = newBall
	
	newBall.Parent = workspace
	script.Parent:Destroy()
	
	local touchCon
	
	touchCon = newBall.Touched:Connect(function(hit)
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if humanoid then
			if hit.Parent.Name ~= char.Name then
				hit.Parent:BreakJoints()
				if touchCon ~= nil then
					touchCon:Disconnect()
				end
				newBall:Destroy()
			end
		end
	end)
	wait(2)

	if touchCon ~= nil then
		touchCon:Disconnect()
	end
	newBall:Destroy()
end

fPressed.OnServerEvent:Connect(onServerEvent)
1 Like

Its network owner is probably set to the server. You can set it to the player throwing the ball, so it will be smoother for them. But it will still be laggy for other players. There isn’t a simple way to fix that.

2 Likes