function MasterControl.GetHumanoid(A)if LocalCharacter then if CachedHumanoid then return CachedHumanoid else CachedHumanoid=LocalCharacter:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")return CachedHumanoid end end end local A=nil local o=nil local function c(c)if A then A:disconnect()end if o then o:disconnect()end LocalCharacter=c CachedHumanoid=LocalCharacter:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")A=c.AncestryChanged:connect(function()if c.Parent==nil then LocalCharacter=nil else LocalCharacter=c end end)o=c.ChildRemoved:connect(function(A)if A==CachedHumanoid then CachedHumanoid=nil end end)end if LocalCharacter then c(LocalCharacter)end LocalPlayer.CharacterAdded:connect(c)local U=MasterControl.GetHumanoid local f=LocalPlayer.Move local R=function()if not areControlsEnabled then return end local A=U()if not A then return end if isJumpEnabled and(isJumping and not A.PlatformStand)then local o=A:GetState()if o~=STATE_JUMPING and(o~=STATE_FREEFALL and o~=STATE_LANDED)then A.Jump=isJumping end end f(LocalPlayer,moveValue,true)end
--
function MasterControl:GetHumanoid()
	if LocalCharacter then
		if CachedHumanoid then
			return CachedHumanoid
		else
			CachedHumanoid = LocalCharacter:FindFirstChildOfClass("Humanoid")
			return CachedHumanoid
		end
	end
end

local characterAncestryChangedConn = nil
local characterChildRemovedConn = nil
local function characterAdded(character)
	if characterAncestryChangedConn then
		characterAncestryChangedConn:disconnect()
	end

	if characterChildRemovedConn then
		characterChildRemovedConn:disconnect()
	end	
	
	LocalCharacter = character
	CachedHumanoid = LocalCharacter:FindFirstChildOfClass("Humanoid")
	characterAncestryChangedConn = character.AncestryChanged:connect(function()
		if character.Parent == nil then
			LocalCharacter = nil
		else
			LocalCharacter = character
		end
	end)
	
	characterChildRemovedConn = character.ChildRemoved:connect(function(child)
		if child == CachedHumanoid then
			CachedHumanoid = nil
		end
	end)
end

if LocalCharacter then
	characterAdded(LocalCharacter)
end
LocalPlayer.CharacterAdded:connect(characterAdded)


local getHumanoid = MasterControl.GetHumanoid
local moveFunc = LocalPlayer.Move
local updateMovement = function()
	
	if not areControlsEnabled then return end
	
	local humanoid = getHumanoid()
	if not humanoid then return end
	
	if isJumpEnabled and isJumping and not humanoid.PlatformStand then
		local state = humanoid:GetState()
		if state ~= STATE_JUMPING and state ~= STATE_FREEFALL and state ~= STATE_LANDED then
			humanoid.Jump = isJumping
		end
	end

	moveFunc(LocalPlayer, moveValue, true)
end
