Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this disable the point light?

Asked by 5 years ago

for _, child in pairs(workspace.Carlights:GetChildren()) do if child.Name == "PointLight" then child.Enabled = false end end

I get no errors, I want it to disable the pointlight in every part named "CarLights"

0
In every part named CarLights? Or in the "Carlights" part, and every part named "PointLight" you want to disable. That's what your code suggests. Check if child.Name == "CarLights", then index that child's PointLight and disable it. pidgey 548 — 5y
0
I dont understand TheOwlFromSaturn 26 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Try using ClassName. Fix: (i think)

for _, child in pairs(workspace.Carlights:GetChildren()) do
    if child.ClassName == "PointLight" then
        child.Enabled = false
    end
end
0
You can simple use if child:IsA("PointLight") then yHasteeD 1819 — 5y
0
It still doesnt work TheOwlFromSaturn 26 — 5y
Ad

Answer this question