What do you want to achieve? Keep it simple and clear!
I want to get the delta of the mouse.
What is the issue? Include screenshots / videos if possible!
I have tried several ways of doing it such as the ones I have provided below, and none of them actually return anything other than a Vector3 (0,0,0)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried things like
UserInputService:GetMouseDelta()
and
local userInputService = game:GetService("UserInputService")
userInputService.InputChanged:Connect(function(io)
userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
if io.UserInputType == Enum.UserInputType.MouseMovement then
print(io.Delta)
end
end
Yet none of them work. I have tried this both in studio and in the roblox app and it is broken in both places. It just prints out a Vector3 with (0,0,0). I have also tried moving the location of the local script. I’ve also made sure that the mouse is locked.
It could be a stupid problem that I just missed, but any help is appreciated!
UserInputService only gives the Delta when the camera moves. Set “CameraMode” in StarterPlayer to “LockedFirstPerson” and move your mouse to get different values for your .InputChanged script.
These examples above are just samples of code that is in a RenderStepped event function. They are taken out of the code and just written out again differently. I should have specified. Locking the mouse in the center every render frame is already done.