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)
If a video is needed I can post one.