Disabling movement in lobby

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

however it’s not working… any help?

You can disable controls in the PlayerModule

local LocalPlayer = game.Players.LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()

Controls:Disable()

Controls:Enable()
1 Like

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.

is the camera mode not in scriptable?

The camera mode is in scriptable

why not just anchor the players?

Dude. I clearly mentioned CAMERA is the issue. The players cannot move while in lobby.

If the camera is scriptable then it cant move with player input, only scripts

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

I have some lerp and run scripts which shift my camera when running or moving left right.