i want to disable player inputs while the main menu gui is active
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local ContextActionService = game:GetService("ContextActionService")
-- Reference the GUI elements
local evademenugui = playerGui.evademenugui
local mainFrame = evademenugui.MainFrame
local shopFrame = evademenugui.ShopFrame
-- Function to toggle visibility of shopFrame based on mainFrame visibility
local function toggleShopFrameVisibility()
if mainFrame.Visible then
shopFrame.Visible = false
ContextActionService:BindAction("DisableInput", function() return Enum.ContextActionResult.Sink end,false,unpack(Enum.PlayerActions:GetEnumItems()))
else
shopFrame.Visible = true
ContextActionService:UnbindAction("DisableInput")
end
end
-- Connect toggleShopFrameVisibility function to mainFrame visibility change
mainFrame:GetPropertyChangedSignal("Visible"):Connect(toggleShopFrameVisibility)
-- Initially hide the shopFrame
shopFrame.Visible = false
local LocalPlayer = game.Players.LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
Controls:Disable()
Controls:Enable()
Okay so my problem is, the input is supposed to be ignored. I have a camera that’s used for main menu and it flips around if I press movement keys on my keyboard. The player may not move, but this problem occurs still.
Therefore, the input should be completely ignored, for all platforms, until the main menu screen is gone.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
wait(3)-- flip camera fix
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Menu.Camera.CFrame