Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED ]Object expected, got CFrame?

Asked by
Oficcer_F 207 Moderation Voter
5 years ago
Edited 5 years ago

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!

0
Can you put the bit where the error occurred back in so the error makes sense? MythicalShade 420 — 5y
0
I did not remove it from this script. The error is at line 11. Oficcer_F 207 — 5y
0
This script is the on that doesn't work at all. No modifications! Oficcer_F 207 — 5y
0
weld.Part1 has to be a base part (object) not a CFrame hellmatic 1523 — 5y
0
Yes. Thank you. Oficcer_F 207 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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

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.. Oficcer_F 207 — 5y
0
Sorry, I looked wrong. OMG Oficcer_F 207 — 5y
Ad

Answer this question