Help with UserInputService.ModalEnabled

is there any errors that come out?

1 Like

nope, nothing at all.
it’s a dead end basically

1 Like

try putting print commands to see what doesnt do pass

i put a print command after the line that changes the ModalEnabled property, and it shows that the line is working.
but the touch controls themselves aren’t hiding or showing after changing it
(and yes the code is in a local script)

I’d just like to point out

	UIS.ModalEnabled = true
	elseif x==1 then
	wait(0.1)
	UIS.ModalEnabled = true

both are set to true

1 Like

oops! thanks for pointing that out. however it still doesn’t change that the touch controls don’t hide after setting it to true.

What I mean to say, is this explains:

I tried several different versions of that code in my script and none of them seemed to work. I even clicked on several side-links that were related and none of them worked. Any other suggestions as to how to make it actually work?

can you try this: print(UIS.ModalEnabled) to see the value

I tried that earlier, and it printed the correct value. But the GUI itself doesn’t disable.

I found this thread:

it has a solution, maybe try it out?

I tried that, but when you turn StarterPlayer.DevTouchMovementMode to Scriptable, it doesn’t let you move at all. And since the poster of that thread wanted there to be absolutely no player movement in his game, it doesn’t work for my game. (an obby game)

since you don’t want them to move, why not set the players speed to zero?

it’s probably not working, it’s probably bugged, there are so much topics about it right now:

1 Like

because when there is a frame on the screen, the touch-movement GUI gets in the way of the buttons. when i try to set movement speed to 0, the character can’t move while the frame is on screen, but the touch-movement gui is still there, causing a disturbance in the frame.

1 Like

You can at least hide the jump button by setting the humanoid’s JumpPower to 0. I can’t figure out why the thumbstick won’t disappear, though. It’s probably just a bug, because ContextActionService touch buttons react to ModalEnabled, just not the thumbstick.

Hello, when I needed to use ModalEnabled I found a different way to do it. What I did was make the controls invisible in the players PlayerGui. I don’t remember how to do it, and I don’t have the script anymore, but here’s what it might look like.

script.Parent.MouseButton1Click:connect(function()
     game.Players.LocalPlayer.PlayerGui.TouchGui.TouchControlFrame.Visible = false
end)

Hope this ends up working for you!

7 Likes

Thanks for telling me that, it worked!

2 Likes

I answered this one just last night.

Disabling the TouchGui isn’t enough, you also will need to disable the controls. I wrote some samples that took this into account after some testing yesterday.

cc @jenae20 @oimatefromscotland

1 Like

More info on the fix: LIVE NOW: Mobile Controls Toggle Fix for ModalEnabled + Upcoming Deprecation