SetStateEnabled trying to disable and enabled character movement

local player = game:GetService("Players").LocalPlayer
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local function onAttributeChanged()
	local canMove = player:GetAttribute("canMove")
	if canMove ~= nil then
		humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, canMove)
		humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, canMove)
		humanoid.AutoRotate = canMove
		print(canMove)
	end
end

player:GetAttributeChangedSignal("canMove"):Connect(onAttributeChanged)

Do not want to set walkspeed and jumppower to 0 to perform this due to how the rest of my scripts work and it would be tedious rewriting all of them. canMove prints correctly but the character can still move when those states are set to false. edit: also is a localscript forgot to mention that, placed in startercharacterscripts