Is there any way to press keyboard button M on mobile?

Is there any way to press keyboard button M on mobile?

local function handleContext(name, state, input)
		if not mapOpen then
			frame.Size = UDim2.new(0.168, 0, 0.311, 0)
			frame.Position = UDim2.new(0.84, 0 , 0.5, 0)

			map.AnchorPoint = Vector2.new(0.5, 0.5)
			map.Size = UDim2.new(zoom, 0, zoom, 0)

			plrPointer.Size = UDim2.new(0.159, 0, 0.159, 0)

			local guiSize = map.AbsoluteSize

			local plrPos = hrp.Position
			local plrX = xUpperBound - plrPos.X
			local plrZ = zUpperBound - plrPos.Z

			local plrXscaled = plrX / realWidth
			local plrZscaled = plrZ / realHeight

			plrXscaled = ((plrXscaled - 0.5) * zoom) + 0.5
			plrZscaled = ((plrZscaled - 0.5) * zoom) + 0.5

			map.Position = UDim2.new(plrXscaled, 0, plrZscaled, 0)

			plrPointer.Position = UDim2.new(0.48, 0, 0.48, 0)

		else
			frame.Size = UDim2.new(0.259, 0, 0.605, 0)
			frame.Position = UDim2.new(0.37, 0, 0.739, 0)

			map.Size = UDim2.new(1, 0, 1, 0)
			map.Position = UDim2.new(0.5, 0, 0.5, 0)

			plrPointer.Size = UDim2.new(0.08, 0, 0.08, 0)

			local x = hrp.Position.X - xLowerBound
			local z = hrp.Position.Z - zLowerBound

			local xScaled = x / realWidth
			local zScaled = z / realHeight

			plrPointer.Position = UDim2.new(xScaled, 0, zScaled, 0)
		end
	end


cas:BindAction("MapZoom", handleContext, true, M)
cas:SetPosition("MapZoom", UDim2.new(0.72, -25, 0.20, -25))
cas:SetImage("MapZoom","http://www.roblox.com/asset/?id=145360686")
cas:GetButton("MapZoom").Size = UDim2.new(0.3, 0, 0.3 ,0)

This method does not work

I don’t think, however you can make a UI button for this.

I made a button, but it doesn’t respond when I press it.

cas:BindAction("MapZoom", handleContext, true, M)
cas:SetPosition("MapZoom", UDim2.new(0.72, -25, 0.20, -25))
cas:SetImage("MapZoom","http://www.roblox.com/asset/?id=145360686")
cas:GetButton("MapZoom").Size = UDim2.new(0.3, 0, 0.3 ,0)

You’ll probably need to make a UI button that you detect when it’s clicked, I didn’t bind actions that much in the past but from what I found, maybe you’ll need to do that. But maybe, I repeat I didn’t bind actions in a while so maybe there’s just a slight error but I don’t see it. If people that are better at binding actions come, only if they say that too then you can make it this way.

I’m not sure if this will help but have you tried using the UserInputService? It could help with solving it, but if not sorry I ain’t the best developer

If you plug in a keyboard to your phone, then you should be able to use UserInputService , if you want to use a service which can automatically create buttons for mobile/tablet users then you may look into ContextActionService.

1 Like

Should I put it in the starter character script?

How does it work without creating a button?

I don’t know why they recommended you VirtualInputManager as it is used internally by Roblox and is only available in CoreScripts

1 Like

Did you see the script I wrote?

I tried using ContextActionService, but it doesn’t work

Is there any other way besides CoreScript?

Start with making a test script which just prints something to see if you can get it working, look at the documentation :slight_smile: personally it was a long time since I used CAS, it shouldn’t be hard :+1:
Going to the supermarket :shopping_cart:

Isn’t it pretty obvious that there is no physical keyboard when using a mobile phone?

Yes, you could connect a keyboard to the phone and it may work. But that’s another scenario that is rarely considered since you would typically buy a mobile phone because it is mobile.

@coolboymc17 It is stated in the Documentation that VirtualInputManager can only used by CoreScripts. There is no relation in providing this solution to the OP, especially if you say exploiters has access to this service.

Now, as to the matter at hand. @jingwon123 The code should definitely work. Are you sure you are testing it in a mobile environment, like testing it in Studio or in a real mobile phone?

If not, check the output. Is there any error or warning that may be causing the issue?

If none, then debug it by using prints.

You could’ve provided these information off the bat instead of waiting for us to request the information from you.

Ah thank you for clarifying that, I was unaware.

I checked that it works when I click the button using print, but the function to enlarge the mini map I want does not work. I don’t know why It’s hard to operate the m button on mobile

local function handleContext(name, state, input)
	
	if state == Enum.UserInputState.Begin then
	
		print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
		
		frame.Size = UDim2.new(0.4, 0, 0.8, 0)
		frame.Position = UDim2.new(0.37, 0, 0.85, 0)

		map.Size = UDim2.new(1, 0, 1, 0)
		map.Position = UDim2.new(0.5, 0, 0.5, 0)

		plrPointer.Size = UDim2.new(0.08, 0, 0.08, 0)

		local x = hrp.Position.X - xLowerBound
		local z = hrp.Position.Z - zLowerBound

		local xScaled = x / realWidth
		local zScaled = z / realHeight

		plrPointer.Position = UDim2.new(xScaled, 0, zScaled, 0)
	end

	end


cas:BindAction("MapZoom", handleContext, true, M)
cas:SetPosition("MapZoom", UDim2.new(0.72, -25, 0.20, -25))


cas:SetImage("MapZoom","http://www.roblox.com/asset/?id=145360686")
cas:GetButton("MapZoom").Size = UDim2.new(0.3, 0, 0.3 ,0)