So I’m making a spawn menu for this gmod-like game and everything works so far except for the mouse unlocking when activating the spawn menu. (Modal does not work)
Here is the script:
local menu = script.Parent
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local mouse = player:GetMouse()
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
uis.MouseBehavior = Enum.MouseBehavior.Default
mouse.Icon = "rbxassetid://16322948261"
menu.Visible = true
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
uis.MouseBehavior = Enum.MouseBehavior.LockCenter
mouse.Icon = "rbxassetid://16305588060"
menu.Visible = false
end
end)
Here is a video: