Enable shift lock by holding right mouse button

I want to make a smooth chracter rotate when i press right mouse button, if possible, enabling the real shiftlock module. But i am using a alternative script to simulate a shift lock.

I tried to search solutions on devforum, but that didn’t help me much.

My code:

local UIS = game:GetService("UserInputService")
local Mouse = game.Players.LocalPlayer:GetMouse()
local Pressed = false
local ToolOn = false
local Disabled = false
local HumanoidRoot = true

script.Parent.Equipped:Connect(function()
	ToolOn = true
	game:GetService("RunService").Stepped:Connect(function()
		local pos = UIS:GetMouseLocation()
	end)
end)

Mouse.Button2Down:Connect(function()
	if ToolOn == true  then
		Pressed = true
		if Disabled == false then
			if Pressed == true then
				repeat
						task.wait(0.001)
					    UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
						local y, x, z= game.Workspace.CurrentCamera.CFrame:ToEulerAnglesYXZ()
						game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position) * CFrame.Angles(0, x, 0)
						game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(2, 0, 0)
					

				until Pressed == false
				game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0)
				UIS.MouseBehavior = Enum.MouseBehavior.Default
				HumanoidRoot = false
				return
			end
		end
	end
end)

Mouse.Button2Up:Connect(function()
	Pressed = false
end)

script.Parent.Unequipped:Connect(function()
	ToolOn = false
end)
5 Likes

I’m also looking for this. I have yet to find a way that doesn’t look laggy other than shift lock for some reason.

1 Like

if you have the current code in a renderstepped or such, you can change the mouse (I’m guessing its the mouse but it might be the camera, i’ll need to check) to LockCenter.

1 Like

im using the lockcenter, but i want to make my character rotate smooth, without renderstep

1 Like

do you have discord? i can help you with that

1 Like