I’m trying to add a script where my character would tilt along with the movement. The script used to make this possible was working fine a few months ago, but now is no longer working. My character spins 90* every second instead of its intended function. Is there any way this script could be fixed? If so, what could I try?
wait()
local localPlayer = game:GetService("Players").LocalPlayer
local Character = localPlayer.Character or localPlayer.CharacterAdded:wait()
local lowerTorso = Character:WaitForChild("LowerTorso")
game:GetService("RunService").RenderStepped:Connect(function()
lowerTorso.Root.C1 = lowerTorso.Root.C1*CFrame.Angles(math.rad(-90),0,0)
end)
there is a way to fix it but since roblox updated the luau functions, it broke so you must find another way to reprogram it with a community source, etc.
This script makes the torso turn 90 degrees every frame
Because it happens so fast, you might not be able to see it, so I suggest using a while loop instead
EDIT: Or change the degree to something low, like 1
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character and plr.Character:FindFirstChild("LowerTorso")
local lowerTorso = plr.Character:FindFirstChild("LowerTorso")
local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local info = TweenInfo.new(
.5,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
)
local a = false
local d = false
local goal1 = {C1 = lowerTorso.Root.C1*CFrame.Angles(0,0,math.rad(0))}
local goal2 = {C1 = lowerTorso.Root.C1*CFrame.Angles(0,0,math.rad(-15))}
local goal3 = {C1 = lowerTorso.Root.C1*CFrame.Angles(0,0,math.rad(15))}
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.A then
a = true
if a == true and d == true then
local tween = ts:Create(lowerTorso.Root, info, goal1)
tween:Play()
else
local tween = ts:Create(lowerTorso.Root, info, goal2)
tween:Play()
end
elseif input.KeyCode == Enum.KeyCode.D then
d = true
if a == true and d == true then
local tween = ts:Create(lowerTorso.Root, info, goal1)
tween:Play()
else
local tween = ts:Create(lowerTorso.Root, info, goal3)
tween:Play()
end
end
end)
uis.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.A then
a = false
if d == false then
local tween = ts:Create(lowerTorso.Root, info, goal1)
tween:Play()
else
local tween = ts:Create(lowerTorso.Root, info, goal3)
tween:Play()
end
elseif input.KeyCode == Enum.KeyCode.D then
d = false
if a == false then
local tween = ts:Create(lowerTorso.Root, info, goal1)
tween:Play()
else
local tween = ts:Create(lowerTorso.Root, info, goal2)
tween:Play()
end
end
end)