Search code examples
exceptionluapositionroblox

position is not a valid member of Part?


i have the code below, it should be working as coping a part called "boulder"(unanchored), and moving it to the desired position, but instead:"position is not a valid member of Part"

while true do
    wait(2)
    local original = workspace.boulder
    -- Create the model copy
    local copy = original:Clone()
    -- Parent the copy to the same parent as the original
    copy.Parent = original.Parent
    -- Move the copy so it's not overlapping the original
    copy.position = CFrame.new(-84.76, 206.227, 143.094) -- where error happens
    Debris:AddItem(copy, 2)
end

Solution

  • The problem you seem to be having is because Position is supposed to have a capital P.

    Fix:

    while true do
    wait(2)
    local original = workspace.boulder
    -- Create the model copy
    local copy = original:Clone()
    -- Parent the copy to the same parent as the original
    copy.Parent = original.Parent
    -- Move the copy so it's not overlapping the original
    copy.Position = CFrame.new(-84.76, 206.227, 143.094) -- Position Capitalised correctly
    Debris:AddItem(copy, 2)
    

    end