function MasterControl.GetHumanoid(N)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 N=nil local F=nil local function O(O)if N then N:disconnect()end if F then F:disconnect()end LocalCharacter=O CachedHumanoid=LocalCharacter:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")N=O.AncestryChanged:connect(function()if O.Parent==nil then LocalCharacter=nil else LocalCharacter=O end end)F=O.ChildRemoved:connect(function(N)if N==CachedHumanoid then CachedHumanoid=nil end end)end if LocalCharacter then O(LocalCharacter)end LocalPlayer.CharacterAdded:connect(O)local l=MasterControl.GetHumanoid local W=LocalPlayer.Move local I=function()if not areControlsEnabled then return end local N=l()if not N then return end if isJumpEnabled and(isJumping and not N.PlatformStand)then local F=N:GetState()if F~=STATE_JUMPING and(F~=STATE_FREEFALL and F~=STATE_LANDED)then N.Jump=isJumping end end W(LocalPlayer,moveValue,true)end
--[[ Local Functions ]]
--
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
