what do you want to achieve?
- I want to achieve a swaying motion when shift lock is activated such as this one:
What is the issue?
- I’m currently unable to achieve the swaying motion when shift lock is activated on my character. I’ve tried different scripts and methods I even made a post before this one, but I’m still not getting the desired effect.
What solutions have you tried so far?
- I have tried to look for solutions on the Roblox Developer form and experiment with different methods, but I’m still unable to get the swaying motion to work.
Here is a sample of the code that I’ve tried:
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
function BaseCamera:UpdateMouseBehavior()
local blockToggleDueToClickToMove = UserGameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove
if self.isCameraToggle and blockToggleDueToClickToMove == false then
CameraUI.setCameraModeToastEnabled(true)
CameraInput.enableCameraToggleInput()
CameraToggleStateController(self.inFirstPerson)
else
CameraUI.setCameraModeToastEnabled(false)
CameraInput.disableCameraToggleInput()
if self.inFirstPerson or self.inMouseLockedMode then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local Character = player.Character
local RootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera
Humanoid.AutoRotate = false
local rx, ry, rz = Camera.CFrame:ToOrientation()
a1 = game:GetService("TweenService"):Create(RootPart, TweenInfo.new(0.09), {CFrame = CFrame.new(RootPart.CFrame.p) * CFrame.fromOrientation(0, ry, 0)})
a1:Play()
else
pcall(function()
a1:Cancel()
a1 = nil
end)
player.Character:WaitForChild("Humanoid").AutoRotate = true
UserGameSettings.RotationType = Enum.RotationType.MovementRelative
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end