Yeah so i was working on my game and noticed that one of the scripts stopped working out of complete nowhere. so i tried reverting the game to a version where the script wasn’t broken to see what caused it to stop. but it also didn’t work on the versions where it was working before.
heres the code if it helps
local RunService = game:GetService'RunService'
local Players = game:GetService'Players'
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass'Humanoid'
local RootPart = Character:WaitForChild'HumanoidRootPart'
local RootJoint = RootPart:WaitForChild'RootJoint'
local RootC0 = RootJoint.C0
local Tilt = CFrame.new()
RunService.RenderStepped:Connect(function(Delta)
local MaxTiltAngle = Humanoid.WalkSpeed/2.25
if MaxTiltAngle > 50 then
MaxTiltAngle = 50
end
if Humanoid:GetState() == Enum.HumanoidStateType.Running then
local MoveDirection = RootPart.CFrame:VectorToObjectSpace(Humanoid.MoveDirection)
Tilt = Tilt:Lerp(CFrame.Angles(math.rad(-MoveDirection.Z) * MaxTiltAngle, math.rad(-MoveDirection.X) * MaxTiltAngle, 0), 0.2 ^ (1 / (Delta * 60)))
RootJoint.C0 = RootC0 * Tilt
script.Parent.RotateServer.RemoteEvent:FireServer(RootJoint.C0)
else
local MoveDirection = RootPart.CFrame:VectorToObjectSpace(Vector3.new(0,0,0))
Tilt = Tilt:Lerp(CFrame.Angles(math.rad(-MoveDirection.Z) * MaxTiltAngle, math.rad(-MoveDirection.X) * MaxTiltAngle, 0), 0.2 ^ (1 / (Delta * 60)))
RootJoint.C0 = RootC0 * Tilt
script.Parent.RotateServer.RemoteEvent:FireServer(RootJoint.C0)
end
end)
anyone know what could be causing this? or is it just a problem on roblox’s end or something?
edit: turns out the character was for some reason spawning with 2 root joints.