R15 Tilt Script not working anymore?

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?

Script: ( Sourced from R15 Character Not Tilting? )

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.

To my mind a 90 degree angle is too much of a tilt. Have you tried adjusting it to a low angle?

It would then spin at that angle each second, so it’s not much of a solution.

“Too much” tilt is completely irrelevant to this, as long as CanCollide is set to false.

@MikeAnchose Do you have any errors?

From what I remember, I have no errors at all.

I don’t see any loops in the function, so it will only spin once. Put them inside a while loop

game:GetService()....
    while true do
        -- here
    end
end)

The character spins 90* each second.

(The current script)

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

I’ve tried doing both, and they crashed my studio.

What I’m trying to accomplish is creating this but in R15.

For the while loop, make sure you add a wait()

EDIT: Or you could just use TweenService

This script works:

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)

You can play around with the TweenInfo part

5 Likes

i humbly ask, may i use this code as well please?

Sure, no worries, the code is not that great anyway