Confusing Error

Or do you want me to send you a place file and see what you can do?

Yeahhh thats whats going on. Its not finding the model in general

I’m going to make a modification to say which part it is not finding, probably some part with a Wrong Name or missing from the FitBody

You’re calling FindFirstChild on NewBody even though it’s a string.

The fix is to cut out .Name here

NewBody = BodyTypes:FindFirstChild(Character:GetAttribute('BodyType',NewBody))

I’ve tried that too it didn’t do anything

this error has already been corrected, but there is another one


Same error

replace the BodyType function with this

function BodyType(Character)
	local TweenIno = TweenInfo.new(0.5,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
	local NewBody = BodyTypes:FindFirstChild(Character:GetAttribute('BodyType'))
	--
	if Character.Humanoid and Character.Humanoid.Health > 0 then
		for Char,BasePart in ipairs(Character:GetChildren()) do
			if BasePart:IsA('BasePart') then
				-- Replace --
				if not NewBody:FindFirstChild(BasePart.Name) then 
					print("Error when looking for a part with the name ["..BasePart.Name.."] in FitBody")
				end
				
				local BasePartGoal = {Size = NewBody:FindFirstChild(BasePart.Name).Size}
				TweenService:Create(BasePart,TweenIno,BasePartGoal):Play()
				for _,M6D in ipairs(Character:WaitForChild('Torso'):GetChildren()) do
					if M6D:IsA('Motor6D') then
						-- Replace --
						local C0Goal = {C0 = NewBody:FindFirstChild('Torso'):FindFirstChild(M6D.Name).C0}
						TweenService:Create(M6D,TweenIno,C0Goal):Play()
					end
				end
			end
		end
	end
end

and send me the print of the “output” and the children of FitBody

The head isn’t ever being sized when changing in the other models

send print of FitBody childs chars

Like the picture of them inside the explorer im confused

yes print of the objects that are inside the FitBody

image

there is the error, the script is trying to find the “Head” in there, and there is nothing with that name

Is there a way I can prevent the script for looking for the BasePart head. As its non-essential to the actual size changing of the character

Of course, I’ll do it for you. you just need to check if you have the part there, and if you don’t just ignore it.

replace the BodyType function with this

function BodyType(Character)
	local TweenIno = TweenInfo.new(0.5,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
	local NewBody = BodyTypes:FindFirstChild(Character:GetAttribute('BodyType'))
	--
	if Character.Humanoid and Character.Humanoid.Health > 0 then
		for Char,BasePart in ipairs(Character:GetChildren()) do
			if BasePart:IsA('BasePart') then
				-- Replace --
				if not NewBody:FindFirstChild(BasePart.Name) then continue end
				
				local BasePartGoal = {Size = NewBody:FindFirstChild(BasePart.Name).Size}
				TweenService:Create(BasePart,TweenIno,BasePartGoal):Play()
				for _,M6D in ipairs(Character:WaitForChild('Torso'):GetChildren()) do
					if M6D:IsA('Motor6D') then
						-- Replace --
						local C0Goal = {C0 = NewBody:FindFirstChild('Torso'):FindFirstChild(M6D.Name).C0}
						TweenService:Create(M6D,TweenIno,C0Goal):Play()
					end
				end
			end
		end
	end
end
2 Likes

It worked!!! thank you so much!

it took a while but we did it xd, if you need to just call, good luck!