I want to achieve the effect of the character’s torso tilting towards the current direction of movement. I’ve searched for possible solutions, but to no avail. What type of methods would I need to use to go about doing this? Any help is appreciated.
Here I wrote that real quick, it’s pretty close to what you want, but it’s not as smooth as the one shown on the gif above and it most likely has some bugs so yeah here’s the script you can play around with it a little.
local userInputService = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humaindRootPart = character:WaitForChild("HumanoidRootPart")
local rootJoint = humaindRootPart:WaitForChild("RootJoint")
userInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.D then
rootJoint.C0 = rootJoint.C0 * CFrame.Angles(0, math.rad(-7), 0)
end
if input.KeyCode == Enum.KeyCode.A then
rootJoint.C0 = rootJoint.C0 * CFrame.Angles(0, math.rad(7), 0)
end
end)
userInputService.InputEnded:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.D then
rootJoint.C0 = rootJoint.C0 * CFrame.Angles(0, math.rad(7), 0)
end
if input.KeyCode == Enum.KeyCode.A then
rootJoint.C0 = rootJoint.C0 * CFrame.Angles(0, math.rad(-7), 0)
end
end)