Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Mouse lock on mobile devices?

Asked by 3 years ago

Hello guys! I'm trying to add mobile support to my Battle Royale game. The problem is that when the player fires the gun with the button, the mouse target changes to the button position in 3D space. I'm trying to lock the mouse in the center, but the output is empty and the target is still not being the center.

game:GetService("RunService").Heartbeat:Connect(function()
    if uis.TouchEnabled == true then
        uis.MouseBehavior = Enum.MouseBehavior.LockCenter
    end
end)

That's the script fragment in which I try to lock the mouse. Thank you for helping!

Answer this question