TweenService:Create failed because Instance is null?

I did this so that when an npc touches you it turns you invisible but I get that error, what do I do?

	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	local humanoidrootpart = hit.Parent:FindFirstChild("HumanoidRootPart")
	local LeftFoot = hit.Parent:FindFirstChild("LeftFoot")
	local LeftHand = hit.Parent:FindFirstChild("LeftHand")
	local LeftLowerArm = hit.Parent:FindFirstChild("LeftLowerArm")
	local LeftLowerLeg = hit.Parent:FindFirstChild("LeftLowerLeg")
	local LeftUpperArm = hit.Parent:FindFirstChild("LeftUpperArm")
	local LeftUpperLeg = hit.Parent:FindFirstChild("LeftUpperLeg")
	local LowerTorso = hit.Parent:FindFirstChild("LowerTorso")
	local RightFoot = hit.Parent:FindFirstChild("RightFoot")
	local RightHand = hit.Parent:FindFirstChild("RightHand")
	local RightLowerArm = hit.Parent:FindFirstChild("RightLowerArm")
	local RightLowerLeg = hit.Parent:FindFirstChild("RightLowerLeg")
	local RightUpperArm = hit.Parent:FindFirstChild("RightUpperArm")
	local RightUpperLeg = hit.Parent:FindFirstChild("RightUpperLeg")
	local UpperTorso = hit.Parent:FindFirstChild("UpperTorso")
	local Head = hit.Parent:FindFirstChild("Head")
-- the error is down here

	local p1 = tween:Create(LeftFoot,info,goal2)
	local p2 = tween:Create(LeftHand,info,goal2)
	local p3 = tween:Create(LeftLowerArm,info,goal2)
	local p4 = tween:Create(LeftLowerLeg,info,goal2)
	local p5 = tween:Create(LeftUpperArm,info,goal2)
	local p6 = tween:Create(LeftUpperLeg,info,goal2)
	local p7 = tween:Create(LowerTorso,info,goal2)
	local p8 = tween:Create(RightFoot,info,goal2)
	local p9 = tween:Create(RightHand,info,goal2)
	local p10 = tween:Create(RightLowerArm,info,goal2)
	local p11 = tween:Create(RightLowerLeg,info,goal2)
	local p12 = tween:Create(RightUpperArm,info,goal2)
	local p13 = tween:Create(RightUpperLeg,info,goal2)
	local p14 = tween:Create(UpperTorso,info,goal2)
	local p15 = tween:Create(Head,info,goal2)

the object is not loaded yet, then the FindFirstChild returns nil

or the toucher is not a rig
if you want to make sure it has a humanoid

if not humanoid then return end

Replace all the FindFirstChild() with WaitForChild(). This would either yield for loading or return the part if it is already loaded.

I get this error when I try with waitforchild
Infinite yield possible on ‘Workspace:WaitForChild(“PLAYER PART”)’

it means it takes too long to load the object

You must check whether it is touched by a player as Baseplate fires Touched event too. Just add this conditional gate:

if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then ```
1 Like