I am making a 'pong' minigame and for the sake of the mobile gui not interfering with the game, I disabled the mobile movement controls during the game. This works fine for turning them off, but turning them back on only restores the jump button. Any ideas why? The relevant code is below.
The variables I made for this part of the code:
--Mobile Control Components local localplr = game.Players.LocalPlayer local playerscripts = localplr:WaitForChild('PlayerScripts') local playergui = localplr:WaitForChild('PlayerGui') local playercontrols = require(playerscripts.PlayerModule):GetControls() local touchgui = playergui:WaitForChild('TouchGui')
The actual function for turning them on and off:
--Disabling Mobile Control playercontrols:Disable() if touchgui then touchgui.Enabled = false end --Coding Quit Button local function closeGame() playercontrols:Enable() if touchgui then touchgui.Enabled = true end script.Parent.Parent:Destroy() end quit.MouseButton1Click:Connect(closeGame)