Make it smoother

Hey, So I made a catching system that allows you to track a footballs position as its in the air but there’s a problem I don’t like about it. When you click it looks like your arms are teleporting instead of following the ball and I wanted to fix that so your arms follow it smoothly. I don’t really know how to do that. I’ve tried doing it work TweenService but it didn’t go as plan. Please help.

Code:

local Player = game:GetService( 'Players' ).LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Torso = Character:WaitForChild( 'Torso' )
local RightArm = Character:WaitForChild('Right Arm')
local LeftArm = Character:WaitForChild('Left Arm')
local Instances = Character:WaitForChild( 'Instances' )
local Mouse = Player:GetMouse()
local Remote = game.ReplicatedStorage.Remotes:WaitForChild('CRemote')
local CDebounce = false
local Football = nil

local function DestroyWelds1(Child)
	if Child.Name == "Football" then
		-- Delay --
		task.wait(1)
		local RAWeld = Instances:FindFirstChild("RAW")
		local LAWeld = Instances:FindFirstChild("LAW")
		-- Destroy --
		if RAWeld and LAWeld then
			RAWeld:Destroy()
			LAWeld:Destroy()
		end
	end
end

local function DestroyWelds2(Child)
	if Child.Name == "Football" then
		local RAWeld = Instances:FindFirstChild("RAW")
		local LAWeld = Instances:FindFirstChild("LAW")
		-- Destroy --
		if RAWeld and LAWeld then
			RAWeld:Destroy()
			LAWeld:Destroy()
		end
	end
end

local function Catch()
	if CDebounce == false then
	CDebounce = true
	if Character:FindFirstChild('Football') then return end
	if workspace:FindFirstChild('Football') then
	-- Instances --
	local RAWeld = Instance.new("Weld")
	local LAWeld = Instance.new("Weld")

	-- Data --
	RAWeld.Name = "RAW"
	RAWeld.Part0 = Torso
	RAWeld.Part1 = RightArm
	RAWeld.Parent = Instances
	LAWeld.Name = "LAW"
	LAWeld.Part0 = Torso
	LAWeld.Part1 = LeftArm
	LAWeld.Parent = Instances

	-- Move Arms --
		for i = 1, 45 do
		Remote:FireServer(true)
		local RCFrame = CFrame.new(Torso.CFrame * Vector3.new(1.2, 1.1, 0), workspace.Football.Handle.Position) * CFrame.Angles(math.pi / 2, 0, 0)
		local LCFrame = CFrame.new(Torso.CFrame * Vector3.new(-1.2, 1.1, 0), workspace.Football.Handle.Position) * CFrame.Angles(math.pi / 2, 0, 0)
		RAWeld.C0 = Torso.CFrame:toObjectSpace(RCFrame) * CFrame.new(0, -.7, .6)
		LAWeld.C0 = Torso.CFrame:toObjectSpace(LCFrame) * CFrame.new(0, -.7, .6)
		task.wait(2 / 45)
		Remote:FireServer(false)
	end
	if RAWeld and LAWeld then
		RAWeld:Destroy()
		LAWeld:Destroy()
			end
			wait(0.8)
			CDebounce = false
		end
	end
end

Mouse.Button1Down:Connect(Catch)
Character.ChildAdded:Connect(DestroyWelds1)
Character.ChildRemoved:Connect(DestroyWelds2)

There is luckily a very easy thing you could do to smooth it out.

I would use make use of RunService, and os.time(). Using RunService is especially important because it runs every frame rather than every .04 seconds like your for loop seemed to be trying to do which makes it much smoother. The code I would erase and rewrite is the for loop under the -- Move Arms -- comment. Try this out for me and tell me if there’s any improvement.

local RS = game:GetService("RunService")

Remote:FireServer(true)
local startTime = os.time()

local track = RS.RenderStepped:Connect(function()
	local RCFrame = CFrame.new(Torso.CFrame * Vector3.new(1.2, 1.1, 0), workspace.Football.Handle.Position) * CFrame.Angles(math.pi / 2, 0, 0)
	local LCFrame = CFrame.new(Torso.CFrame * Vector3.new(-1.2, 1.1, 0), workspace.Football.Handle.Position) * CFrame.Angles(math.pi / 2, 0, 0)
	RAWeld.C0 = Torso.CFrame:toObjectSpace(RCFrame) * CFrame.new(0, -.7, .6)
	LAWeld.C0 = Torso.CFrame:toObjectSpace(LCFrame) * CFrame.new(0, -.7, .6)
	if os.time() - startTime >= 2 then -- After 2 seconds, it stops tracking
		track:Disconnect()
		Remote:FireServer(false)
	end
end)

It gave me this error about Track:Disconnect()

local track
track = RService.RenderStepped:Connect(function() 
track:Disconnect() 
end)

You would need to refer track as a seperate variable and then connect it to the event.

Now it spams that football isn’t found. How would I make it so if the player does have all ball equipped they cant catch anymore?