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

The code i have for locking the cursor to the center of the screen doesn't seem to work?

Asked by 4 years ago

I know that the line of code is running because in the same block i have a hide cursor icon thing and that works but then the lock cursor to center piece just wont work. Ill give the scripts involved, there are other lines of code in the script but i dont want to paste all of it unless needed.

local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")

wait(0.5)
Camera.CameraType = Enum.CameraType.Scriptable
userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
userInputService.MouseIconEnabled = false

Also i am fairly new to lua so this could be a really easy fix that i dont see

0
Edit: I thought i should mention that what these lines are in is its trying to make an over the shoulder camera view where you are aimed forwards, but i cant really do that without the cursor being locked Voidyll 8 — 4y

Answer this question