I get this error: Invalid argument #1 to 'pairs' (table expected, got Instance)
Here’s the code:
for i, v in pairs(Reactor) do
v.ReactorLight1.Attachment.PointLight.Enabled = true
end
Any help is appreciated, Thanks.
I get this error: Invalid argument #1 to 'pairs' (table expected, got Instance)
Here’s the code:
for i, v in pairs(Reactor) do
v.ReactorLight1.Attachment.PointLight.Enabled = true
end
Any help is appreciated, Thanks.
If you want to get the Items inside the Object, you use Instance:GetChildren()
for the Direct Children, But for All Children, you use Instance:GetDescendants()
, What this will do is return an Array of Instances
that are Parented under the Object, In other words, Gives you a table.
So It should be Reactor:GetChildren()
or Reactor:GetDescendants()
I get this error: Attachment is not a valid member of Attachment "Workspace.Reactor.ReactorLight1.Attachment"
Make sure you check if the Object Exists using :FindFirstChild()
, which should Prevent this error from Occuring
local obj = v.ReactorLight1:FindFirstChild("Attachment")
if obj then
-- code
end
I get this: invalid argument #1 to 'pairs' (table expected, got Instance)
It’s been long since you replied to me.
I fixed the problem now, anyways, tnanks to you for solving.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.