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)