职位不是Part的有效成员吗?

问题描述 投票:0回答:1

我有下面的代码,它应该作为一个称为“巨石”(未固定)的零件,然后将其移动到所需位置,但是:“该位置不是零件的有效成员”

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
exception lua position roblox
1个回答
0
投票

您似乎遇到的问题是因为Position应该具有大写字母P。

修复:

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)

结束

© www.soinside.com 2019 - 2024. All rights reserved.