Cframe is not a valid member of part

I was following a tutorial and I tried the script but it dosent work and I get the error Cframe is not a valid member of Part “Workspace.eiavops.Head” the script works on the yt video and i checked that its the exact same

local part = script.Parent

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local head = hit.Parent.Head
		part.CFrame = head.Cframe * CFrame.new(0,10,0)
		local weld = Instance.new("Weld")
		weld.Part0 = head
		weld.Part1 = part
		weld.C0 = head.Cframe:Inverse()
		weld.C1 = part.CFrame:Inverse()
		weld.Parent = part	
	end
end)
3 Likes

Maybe its CFrame instead of Cframe:

local part = script.Parent

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local head = hit.Parent.Head
		part.CFrame = head.CFrame * CFrame.new(0,10,0)
		local weld = Instance.new("Weld")
		weld.Part0 = head
		weld.Part1 = part
		weld.C0 = head.CFrame:Inverse()
		weld.C1 = part.CFrame:Inverse()
		weld.Parent = part	
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.