I really need help with something that may seem non-important but is very inconvenient. Whenever I right click to drop an item in my game, it re-centers the mouse in which I dont want that to happen. How would I go to fix this issue?
I have fixed the issue but it was relatively difficult to think about. It was more or less an addition to what I coded that checks the modal:
local RunService = game:GetService("RunService")
RunService:BindToRenderStep("MouseLock",Enum.RenderPriority.Last.Value+1,function()
if inventory:WaitForChild("AllowMouse").Modal == false then
camera.CameraType = Enum.CameraType.Custom
userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
--character.Torso.Anchored = false
else
camera.CameraType = Enum.CameraType.Scriptable
--character.Torso.Anchored = true
end
end)
This would set the camera type to “Scriptable” which Scriptable does not re-center the mouse when you right click. Now the only issue to be faced now is that my character can move but not the camera in scriptable.
So within a render stepped event I did this:
if camera.CameraType == Enum.CameraType.Scriptable then
camera.CFrame = CFrame.new(Vector3.new(humanoidRootPart.Position) + Vector3.new(0,1.5,0)) * CFrame.Angles(camera.CFrame:toEulerAnglesXYZ())
end