Help with procedural animation with IK constraints

I’m trying to challenge myself by making a procedural animation system, but as you can see the IK works to an extent but it doesn’t prioritize lower attachment and lower the entire body with it. I’m new to scripting so the methods I use and my organization might not be the best. It was all done in a local script in StarterPlayerScripts.

Code:

--//SETTINGS
local ikType = Enum.IKControlType.Transform
local ikWeight = 0.5
local ikSmoothness = 0.05


--//Services
local RS = game:GetService("RunService")
local RStore = game.ReplicatedStorage

--//Player
local players = game:GetService('Players')
local player = players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:FindFirstChild("Humanoid")
local humRoot = char:FindFirstChild("HumanoidRootPart")

--//IK/Attachments
local IKLeft = Instance.new("IKControl")
IKLeft.Parent = humRoot
IKLeft.Weight = ikWeight
IKLeft.SmoothTime = ikSmoothness
IKLeft.Type = ikType
IKLeft.ChainRoot = char.LeftUpperLeg
IKLeft.EndEffector = char.LeftFoot
local IKRight = IKLeft:Clone()
IKRight.Parent = humRoot
IKRight.Weight = ikWeight
IKRight.SmoothTime = ikSmoothness
IKRight.Type = ikType
IKRight.ChainRoot = char.RightUpperLeg
IKRight.EndEffector = char.RightFoot
local attachLeft = Instance.new("Attachment")
attachLeft.Parent = IKLeft
attachLeft.Visible = true
local attachRight = attachLeft:Clone()
attachRight.Parent = IKRight
attachRight.Visible = true

--//Main
local leftParams = RaycastParams.new()
leftParams.FilterType = Enum.RaycastFilterType.Exclude
leftParams.FilterDescendantsInstances = {char.LeftFoot, char.LeftLowerLeg}

local rightParams = RaycastParams.new()
rightParams.FilterType = Enum.RaycastFilterType.Exclude
rightParams.FilterDescendantsInstances = {char.RightFoot, char.RightLowerLeg}

RS.RenderStepped:Connect(function()
	local leftRaycast = workspace:Raycast(char.LeftFoot.Position, Vector3.new(0,-10, 0), leftParams)
	local rightRaycast = workspace:Raycast(char.RightFoot.Position, Vector3.new(0,-10, 0), rightParams)
	if leftRaycast and rightRaycast then
		attachLeft.WorldPosition = leftRaycast.Position
		attachRight.WorldPosition = rightRaycast.Position
		IKLeft.Target = attachLeft
		IKRight.Target = attachRight
	end
end)