Hello again, I’ve been working for the last few days and I come across a new issue. I’m trying to make a script that detects a part and if that part doesn’t exist then the script just ignores it and goes on. Problem is that the script keeps throwing the “is not a valid member of Model” or something, I forgot. Here’s the example script.
if game.Workspace.TestFrame.Colors then
for i, v in pairs(game.Workspace.TestFrame.Colors:GetChildren()) do
if v.Name == “Color” then
print(“Color exist”)
elseif v == nil then
print(“Color doesn’t exist”)
end
end
end
if workspace:FindFirstChild("TestFrame"):FindFirstChild("Colors") then
for i, v in workspace.TestFrame.Colors:GetChildren() do
if v.Name == “Color” then
print(“Color exist”)
elseif v == nil then
print(“Color doesn’t exist”)
end
end
end
Are you sure the TestFrame and Colors exist in the workspace? If they are adding after the game is loaded you can try adding WaitForChild
workspace:WaitForChild("TestFrame"):WaitForChild("Colors")
if workspace:FindFirstChild("TestFrame"):FindFirstChild("Colors") then
for i, v in workspace.TestFrame.Colors:GetChildren() do
if v.Name == “Color” then
print(“Color exist”)
elseif v == nil then
print(“Color doesn’t exist”)
end
end
end