I am currently trying to make a script to unlock the player’s mouse when they press T. If I try to make more UI elements to show the mouse is unlocked, the mouse doesn’t unlock. Here is my current script:
local UserInputService = game:GetService("UserInputService")
local UI = script.Parent.Parent
local Value = 0
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.T then
if Value == 0 then
UI.Enabled = true
Value = 1
else
if Value == 1 then
UI.Enabled = false
Value = 0
end
end
end
end)
Oh, I found out I just had to enable modal on the UI. Although is there a way I can use studio without it preventing me from selecting parts from clicking on them?