ดังนั้น ฉันกำลังสร้างสคริปต์ปุ่ม เมื่อคลิกแล้ว หากเงื่อนไขใดเงื่อนไขหนึ่งเป็นจริง มันจะค้นหารายการย่อยทั้งหมดของรุ่นอื่น แต่เมื่อฉันพบรายการย่อย มันทำให้ฉันมีข้อผิดพลาดโดยแจ้งว่า "Obj ไม่ใช่สมาชิกที่ถูกต้องของ model" แล้วไม่ได้ทำอะไรเลย
นี่คือรหัสของฉัน:
script.Parent.Touched:Connect(function(hit)
if(hit.Name == "RightFoot" or hit.Name == "LeftFoot") then
if(script.Parent.Color == Color3.fromRGB(0, 255, 0)) then
--This line is where im getting problems, when i do this :GetChildren
for _, object in pairs(script.Parent.Parent.Obj:GetChildren()) do
if(object:IsA("BasePart")) then
object.CanCollide = true
object.Transparency = 0
end
end
end
end
end)