Help with a magic control system

Hello I am trying to make a system where you can control the projectiles you shoot

like in this video skip to 7:57.

I am a new scripter.
I asked a similar question 3ish days ago and some one help me greatly with the script
this is the script I have so far.

local UIS = game:GetService(“UserInputService”)
local RunService = game:GetService(“RunService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local RE = ReplicatedStorage.Missile
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local MaxDistanceTraveled = 30000
local mouse = game.Players.LocalPlayer:GetMouse()

local MissleVelocity = 1

UIS.InputEnded:Connect(function(input,typing)
if input.KeyCode == Enum.KeyCode.F and not typing then

	local MagicMissle = ReplicatedStorage.MagicMissle:Clone()--The magic thingy we are firing forward
	local StartPos = char:WaitForChild("RightHand").Position
	MagicMissle.CFrame = CFrame.new(StartPos, mouse.Hit.Position)
	
	MagicMissle.Parent = workspace --Parenting it to workspace so we can see it		
	
	
	local OnFrame --this is the variable that will hold our .Heartbeat connection
	OnFrame = RunService.RenderStepped:Connect(function(DeltaTime)--runs every frame
		MagicMissle.CFrame = CFrame.new(mouse.Hit.Position,StartPos)
		MagicMissle.CFrame *= 
			CFrame.new(0,0, -MissleVelocity * DeltaTime * 60)-- * 
		--	CFrame.new(DeltaTime * 60 * mouse.Hit.Position/500)
		
		if (MagicMissle.Position - StartPos).Magnitude > MaxDistanceTraveled then
				--the missle went too far!
			game.Debris:AddItem(MagicMissle, 1)

end
end)
end
end)

Any new things will help i am a new scripter that needs to learn a lot.