Why does this script not work with R6

Hello Dev’s I have a script that seems to only work in R15 and not in R6, and I wanted to convert it to R6, so what do I need to change in order to achieve this?

Here’s the script I would really appreciate any and all help!

local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local PlayerMouse = Player:GetMouse()

local Camera = workspace.CurrentCamera

local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local Neck = Head:WaitForChild("Neck")

local Torso = Character:WaitForChild("UpperTorso")
local Waist = Torso:WaitForChild("Waist")

local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

local NeckOriginC0 = Neck.C0
local WaistOriginC0 = Waist.C0

Neck.MaxVelocity = 1/3

RunService.RenderStepped:Connect(function() 
	local CameraCFrame = Camera.CoordinateFrame

	if Character:FindFirstChild("UpperTorso") and Character:FindFirstChild("Head") then
		local TorsoLookVector = Torso.CFrame.lookVector
		local HeadPosition = Head.CFrame.p

		if Neck and Waist then
			if Camera.CameraSubject:IsDescendantOf(Character) or Camera.CameraSubject:IsDescendantOf(Player) then
				local Point = PlayerMouse.Hit.p

				local Distance = (Head.CFrame.p - Point).magnitude
				local Difference = Head.CFrame.Y - Point.Y

				Neck.C0 = Neck.C0:lerp(NeckOriginC0 * CFrame.Angles(-(math.atan(Difference / Distance) * 0.5), (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 1, 0), 0.5 / 2)
				Waist.C0 = Waist.C0:lerp(WaistOriginC0 * CFrame.Angles(-(math.atan(Difference / Distance) * 0.5), (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 0.5, 0), 0.5 / 2)
			end
		end
	end	
end)

Thanks!

1 Like

UpperTorso doesn’t exist in an R6 avatars

You will need to check what avatar type the player has

local Torso
if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
   Torso = Character:WaitForChild("UpperTorso")
else
   Torso = Character:WaitForChild("Torso")
end
3 Likes

Thanks for the help, I think there’s 2 or 3 other problems that I found let me high light them in a screen shot one sec.

Edit:

Here was some of the things I need to change for the script because its r6 and they don’t exist on the r6 body compared to the r15 body.

Edit 2:

Here’s the other half of the code if you need to see.

1 Like

The neck of an R6 avatar is inside under the torso, and only R15 avatars have the waist, you’ll need to find something else to replace it with. Use the way I showed to change them.

1 Like

So now all I need to do is replace the waist, but with what?

1 Like

I don’t know, try to find something similar. There’s a preinstalled plugin called “Build Rig”, you can import blank R6 and R15 avatars to see what you can replace it with.

1 Like

Because R6 is so simple its got nothing like the waist.

jpeg

The waist is just an attachment, not a part, try connecting it to the Root Hip under HumanoidRootPart, it’s the closest thing.

This?

save

1 Like

Yeah.

3OCharacters3Ocharacters

2 Likes

What does that mean again sorry.

Because it’s for R15 libs. Try editing with R6’s.

1 Like

What are gibs if you dont mind me asking?

Im super new to all this so sorry if im getting lost very easily…

Does anyone have discord so I can ask some questions and figure this out?

I’m starting to get some where, but i have this one problem.

There is no C0 property inside the attachments

so what do I put in there instead