function openMenu()
	navPosition = "1"
	getAndSetNavPos(navPosition)
	
	local function showInfo()
		infoPanel:TweenPosition(UDim2.new(0, 140,0, 0),"Out","Linear",0.1,true)
		playerName:TweenPosition(UDim2.new(0.271, 0,0.28, 0),"Out","Linear",0.1,true)
		infoPanel.Visible = true
		playerName.Visible = true
	end
	local position = UDim2.new(0,0,0,530)
	local tweenTime = 0.1
	firstButtons.Visible = true
	for i=#navButtons[1],1,-1 do
		navButtons[1][i]:TweenPosition(position,"Out","Linear",tweenTime,true)
		position = position - UDim2.new(0,0,0,55)
		tweenTime = tweenTime + 0.05
	end
	wait(0.1)
	showInfo()
end


function onKeyPress(inputObject, chat)
	
	if not chat then
		if inputObject.KeyCode == Enum.KeyCode.M then
			
		
			navigateMenu(inputObject.KeyCode)
			if controlScript.Disabled == false then
				print(controlScript.Disabled)
			--player.Torso.Anchored = true
			controlScript.Disabled = true
				openMenu()
			elseif controlScript.Disabled == true then
				print(controlScript.Disabled)
				--player.Torso.Anchored = false
				controlScript.Disabled = false
				closeMenu()
			end
		else
			if controlScript.Disabled == true then
				 navigateMenu(inputObject.KeyCode)
			end
		end
	end
end




game:GetService("UserInputService").InputBegan:connect(onKeyPress)

pressing M does nothing and doesnt print anything. ive made keyDown scripts before so i have no idea why this one isnt working.

what i'm trying to do is open a menu by pressing a button... and thats it. nothing else to explain...

thanks to all that help me.

2 comments

0

Can you show the parts of the script that contribute to the UserInput event and function?

0

changed and added stuff