local MouseUnlock = {}
function MouseUnlock.Start()
print("Started MouseUnlock Module")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local CollectionService = game:GetService("CollectionService")
local player = Players.LocalPlayer
local mouseUnlocked = Instance.new("BoolValue", player)
mouseUnlocked.Name = "MouseUnlocked"
mouseUnlocked.Value = false
for _, v in ipairs(CollectionService:GetTagged("Draggable")) do
print("1st iteration")
if v:IsA("DragDetector") then
print("2nd if statement")
v.DragStart:Connect(function(player)
mouseUnlocked.Value = true
end)
v.DragEnd:Connect(function()
mouseUnlocked.Value = false
end)
end
end
RunService:BindToRenderStep("MouseBehaviorCustom", Enum.RenderPriority.Camera.Value + 1, function()
if mouseUnlocked.Value then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end)
end
return MouseUnlock
![]()

Hi all, this is a script where the mouse unlocks when using a drag detector. The drag detectors are located inside MainPart and are tagged Draggable. This however only works on some drag detectors, when I use some drag detectors, the mouse unlocking doesn’t work, but on some it does work. I’m not sure what the issue is and was wondering someone could help. ![]()