Hello! I have been really needing a script that allows you to move the camera like normal but where you don’t have to hold right click on the mouse. I’ve been trying to find a way but just can’t find anything. Help would be greatly appreciated!
Here’s an example of kind of what I’m going for:
If you know how to help, please message me as soon as possible.
Thanks,
@LlCHTENBERG
Use UserInputService.MouseBehavior to change the mouses behavior, setting it to Enum.MouseBehavior.LockCenter to lock it to the middle of the screen.
You’ll need to set a Heartbeat event with RunService to set the MouseBehavior to LockCenter so it stays locked. You can also set the mouse to not be visible with UserInputService.MouseIconEnabled
That can’t be easily force enabled by the developer, so I don’t think its the solution he’s looking for
I tried this to one of my local scripts but nothing happened:
local UIS = game:GetService("UserInputService")
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
am I doing something wrong?
like @KdudeDev mentioned, you need to set the mousebehavior every HeartBeat event with RunService. So your script would look something like this:
local UIS = game:GetService("UserInputService")
local rs = game:GetService("RunService")
rs.Heartbeat:Connect(function()
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
end)
put this in in a localscript in StarterPlayerScripts and you should be good.
Great! that worked! thank you so much! But do you know how to make it so that the body moves up and down to follow y-axis movements like in the video?
I myself do not know how to make this but I found a great post that does work! (I tested it myself and it works perfectly) The link to that post is here: Need help with torso and head following mouse - #5 by DDoSingClocks just paste the code that is listed in the solution and change the RunService.RenderStepped:Connect(function() to rs.RenderStepped:Connect(function()
