You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to lock the Mouse like shiftlock dose!
-
What is the issue? I don’t know how to
-
What solutions have you tried so far? Nope
You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to lock the Mouse like shiftlock dose!
What is the issue? I don’t know how to
What solutions have you tried so far? Nope
so you mean you want to force a player to shiftlock?
No, I want to angle the Camera where every I want, Like shiftlock dose. Meaning the players’ camera will move more right.
No, What I’m meaning is not to force shiftlock, I’m trying to change the position of the Camera.
then use Camera.CFrame you can know more about CFrame at the Developer Hub
I tried but the camera glitches:
local ERROR_MESSAGE = "There was an error trying to use "..script:GetFullName()
repeat wait()
until workspace.CurrentCamera
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = CFrame.new(1, 1, 1, -5)
This is how you can make a player look at a part:
-- ClientScript
local camera = game.Workspace.CurrentCamera -- Cam
local localplayer = game:GetService("Players").LocalPlayer -- Player
local char = localplayer.Character
local PartToLookAt = game.Workspace.Part -- Link to the part you want the player to look at!
pcall(function()
camera.CFrame = CFrame.new(camera.CFrame.Position, PartToLookAt.Position)
end)
if you want them to keep looking:
– ClientScript
local camera = game.Workspace.CurrentCamera -- Cam
local localplayer = game:GetService("Players").LocalPlayer -- Player
local char = localplayer.Character
local PartToLookAt = game.Workspace.Part -- Link to the part you want the player to look at!
game:GetService("RunService").RenderStepped:Connect(function()
pcall(function()
camera.CFrame = CFrame.new(camera.CFrame.Position, PartToLookAt.Position)
end)
end)
Hope this helped
Ya but what if I want to make it look somewhere else ?
Do you want to make that Shoulder style that Shiftlock gives you? If so, just use the CameraOffset
property of the Character’s humanoid
Ok, it works but what about the mouse?
You want it to lock in the center?
Yes, lock in the center or anywhere else
I think you can just use UserInputService’s MouseBehavior property and set it to LockCenter, try adding this line
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
Somewhere in your localscript
It seems to not be working…
game:GetService('UserInputService').MouseBehavior = Enum.MouseBehavior.LockCenter
The mouse dosent lock…
Try setting it every frame
local userinputservice = game:GetService("UserInputService")
game:GetService("RunService").Heartbeat:Connect(function(dt)
userinputservice.MouseBehavior = Enum.MouseBehavior.LockCenter
end)
Found this from this solution
Like on a position, not a part?
Yup! Yeah, in a position not partt
How about this:
-- ClientScript
local camera = game.Workspace.CurrentCamera -- Cam
local localplayer = game:GetService("Players").LocalPlayer -- Player
local char = localplayer.Character
local Position = Vector3.new(10,10,10) -- Link to the part you want the player to look at!
game:GetService("RunService").RenderStepped:Connect(function()
pcall(function()
camera.CFrame = CFrame.new(camera.CFrame.Position, Position)
end)
end)
Did you try out what I posted?