What I want the script to do is see if ORDER is inside of v then it will run the rest but it gives me an error saying the ORDER is not a valid member of the script that is also in that group.
script.Parent.Changed:Connect(function() if script.Parent.Enabled == true then for i,v in pairs(folder:GetChildren())do if v.ORDER ~= nil then if v.ORDER.Value == 1 then cam.CameraType = Enum.CameraType.Scriptable cam.CameraSubject = v end end end end end)
Use FindFirstChild()
, so that it doesn't error when the part doesn't exist
script.Parent.Changed:Connect(function() if not script.Parent.Parent.Enabled then return end for i,v in pairs(folder:GetChildren()) do local order = v:FindFirstChild("ORDER") --here, see? if order and order.Value == 1 then --check if it exists and if its value == 1 cam.CameraType = Enum.CameraType.Scriptable cam.CameraSubject = v end end end)