Character Controller doesn't accurately depict what's happening

  1. What do you want to achieve?
    I am currently trying to connect my custom character controller, that’s built on the ControllerManager with my custom animations script.

  2. What is the issue?
    The issue is that, despite everything being connected correctly, the falling state is often missing whenever you jump. (You can see it in the provided screenshot of the output.)
    image

  3. What solutions have you tried so far?
    I’ve tried using a Highlight to make sure that the ground sensor isn’t the one cause issues, it wasn’t and it was sensing the ground correctly. I tried switching between different updating events instead of the “PreAnimation” like the tutorial for the ControllerManager said to do so, nothing fixed this issue.

SNIPPET OF THE STATE CODE:

function check_swim_state() : boolean
	return is_swimming()
end

function check_run_state() : boolean
	local ground_sensed_part = ground_sens.SensedPart
	
	return ground_sensed_part ~= nil
end

function check_climb_state() : boolean
	local climb_sensed_part = climb_sens.SensedPart
	
	return climb_sensed_part ~= nil
end

function set_state(state_name : string) : nil
	local con = name_to_con[state_name]
	if con_manager.ActiveController ~= con then
		con_manager.ActiveController = con
		character:SetAttribute("State",state_name)
	end
end

function update_state() : boolean
	if character:GetAttribute("Ragdolled") then
		con_manager.ActiveController = nil
		character:SetAttribute("State","Ragdoll")
		
	elseif check_swim_state() then
		set_state("Swim")

	elseif check_run_state() then
		set_state("Ground")
		
	elseif check_climb_state() then
		set_state("Climb")
		
	else
		set_state("Air")
	end
end

Ah shoot, I found the issue. In the jump function, I set the controller to air instead of changing the state!