How do I change the settings of all the point light in the game? Is there a way to do that through scripting? I would like to change It because it is way too laggy with all the lights
for i,v in pairs(game:GetDescendants()) do
if v:IsA("PointLight") then
-- change something
end
end
Run this in the command bar of your game, may lag for a few seconds/minutes depending on your PC, but should work.
would this save? like I mean would it apply the changes
Yes, run it in the command bar in Studio.
If you copy and paste the properties & their values you want them to have I can make an edit to the script which you can use.
Would you like to remove them? Since they are causing a lot of lag?
for i, v in pairs(workspace:GetDescensdants()) do
if v:IsA(“PointLight”) then
v.Brightness = v.Brightness/4
end
end
is this good?
I mean I would like to remove them but only half of them
How do you run the command bar though? I put it in it but it doesn’t run
for i, v in pairs(workspace:GetDescendants()) do
if v:IsA("PointLight") then
v.Brightness = v.Brightness/4
end
end
That would work although you misspelt “GetDescensdants”, it should be “GetDescendants”. All you need to do is copy & paste the script into the command bar and hit enter and it should work.
ok thanks. Didn’t realize that sorry
it worked but I don’t think it solved the problem cause its still too laggy. I think its just because there are too many parts
Could be, if you’d like to remove all of them you can use the following script:
for i, v in pairs(workspace:GetDescendants()) do
if v:IsA("PointLight") then
v:Destroy()
end
end
ok thank you so much
Ill try it