So I'm trying to do a script that prints something when the circle it's touched by a player. (workspace > folder > model > "Circle") But I still get the error attempt to call a nil value
visible_planets = workspace.planets:GetDescendants()
hidden_planets_folder = game.ReplicatedStorage.planets
circles = {}
for key, model in pairs(visible_planets) do
if model.ClassName == "Model" then
circle = model:FindFirstChild("Circle")
table.insert(circles, circle)
print(table.getn(circles))
end
end
function get_planet(x)
local partParent = x.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
print('ball touched')
end
end
for k,v in pairs(circles) do
v.Touched:Connect(get_planet(v))
end

1 comment
Error basically means you tried to call a value from a function that is nil.