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 dissapear 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.