Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED ]Object expected, got CFrame?

Hey, I am following a tutorial, and in the tutorial, it works totally fine, but for me, I get this error:

** Workspace.Part.Script:14: bad argument #3 to 'Part1' (Object expected, got CFrame)

Why? This is my script:

script.Parent.Touched:Connect(function(hit)
	
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		
		local head = humanoid.Parent.Head
		
		local weld = Instance.new("Weld")
		weld.Part0 = head
		weld.C0 = head.CFrame:inverse()
		weld.Part1 = script.Parent.CFrame:inverse()
		weld.C1 = script.Parent.CFrame:inverse()
		weld.Parent = head
		script.Parent.Anchored = false
	end
	
	
end)

Why doesn't it work? I removed the CFrame bit, where the error occurred, but then the welded brick didn't follow my CFrame coordinates. PLEASE HELP!

5 comments

0

Can you put the bit where the error occurred back in so the error makes sense?

0

I did not remove it from this script. The error is at line 11.

0

This script is the on that doesn't work at all. No modifications!

0

weld.Part1 has to be a base part (object) not a CFrame

0

Yes. Thank you.

1 answer

✓ Accepted answer

Mate, you gave a CFrame on line 11, it specifically says "Part1" not C0/1, give an object not a rotational direction.

2 comments

0

But how can I make the object follow my position? Because if I jump, I gets stuck under my players foot. And, in the tutorial I watched, it worked..

0

Sorry, I looked wrong. OMG

This discussion is preserved as it was. New answers, comments, and votes are closed.