I want to use ModalEnabled for my game but it does not work.
Whenever a player touches a brick, I want ModalEnabled to be set to true so all the mobile controls disapear and stop working.
However, whenever ModalEnable is set to true, the mobile controls do not stop working and they are still visible.
I’ve tested this out with the following script which is placed inside the StarterCharacterScripts
--LOCALSCRIPT inside StarterCharacterScripts
UIS = game:GetService('UserInputService')
debounce = false
game.Workspace.Part.Touched:Connect(function(hit)
if debounce == false then
debounce = true
if hit.Parent:FindFirstChild("Humanoid") then
wait(1)
print("test")
UIS.ModalEnabled = not UIS.ModalEnabled
wait(5)
end
debounce = false
end
end)
Is there anything else besides ModalEnabled which I can use to temporarily deactivate the mobile controls? Making the TouchGui invisible is not what I want, because the controls will still be working.y.
I have an updated response regarding ModalEnabled that I’ve posted recently. The delay method doesn’t have any guarantees nor is it supported, so it could go wrong at any time.
I’ve set the player devtouchmovementmode to 5 (which is scriptable) whenever a player is not allowed to use the mobile buttons. When the player is allowed to move again, The devtouchmovementmode is set back to 0 (which is the userchoice).