Use a script to make the legs (either separated or in the same script) go in the opposite direction the Root tilt. If the Root were to tilt 15 degrees, the legs would tilt -15 degrees, making them still planted on the ground while walking.
This is assuming you already have the Root tilt script.
local Run = game:GetService("RunService")
local UserInput = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = Character:WaitForChild("Torso")
UserInput.InputBegan:Connect(function(Input1, Processed)
if Processed then
return
end
if Input1.KeyCode == Enum.KeyCode.A or Input1.KeyCode == Enum.KeyCode.D then
local Connection1
Connection1 = Run.RenderStepped:Connect(function()
if UserInput:IsKeyDown(Enum.KeyCode.A) then
Torso.CFrame *= CFrame.Angles(math.rad(Torso.CFrame.Rotation.X), math.rad(Torso.CFrame.Rotation.Y), math.rad(Torso.CFrame.Rotation.Z + 5))
elseif UserInput:IsKeyDown(Enum.KeyCode.D) then
Torso.CFrame *= CFrame.Angles(math.rad(Torso.CFrame.Rotation.X), math.rad(Torso.CFrame.Rotation.Y), math.rad(Torso.CFrame.Rotation.Z - 5))
else
Connection1:Disconnect()
end
end)
local Connection2
Connection2 = UserInput.InputEnded:Connect(function(Input2, Processed)
if Processed then Connection2:Disconnect() return end
if Input2.KeyCode == Input1.KeyCode then
Torso.CFrame *= CFrame.Angles(0, 0, 0)
Connection2:Disconnect()
end
end)
end
end)