I wanted to make a script so that when I hold LeftAlt it unlocks the mouse from the center, and when you let go, it locks again.
local UserInt = game:GetService("UserInputService")
UserInt.InputBegan:Connect(function(input, gameProcessed, IsTyping)
if IsTyping then return end
if input.KeyCode == Enum.KeyCode.LeftAlt then
UserInt.MouseBehavior = Enum.MouseBehavior.Default
end
end)
UserInt.InputEnded:Connect(function(input, gameProcessed, IsTyping)
if IsTyping then return end
if input.KeyCode == Enum.KeyCode.LeftAlt then
UserInt.MouseBehavior = Enum.MouseBehavior.LockCenter
end
end)
but everytime I let go of alt, it goes to the center but its not locked there. (by it being "unlocked" I mean I can still move my mouse across the screen)
https://medal.tv/clips/31967330/d1337sPhVH2W as you can see you can still move it after it goes to the center
Help would be greatly appreciated.
