[SOLVED] Function Doesnt Change Parts Materials or Toggle Lighting?
Asked by
2 years ago Edited 2 years ago
i found out what the problem was, instead of doing it for all the children, it picks a random one and does the script for that one only while all the others just stay on, if anyone can help that would be awesome
Script
01 | local function light(materialone, materialtwo, lighting) |
02 | for _, child in ipairs (script.Parent:GetChildren()) do |
03 | child:FindFirstChild( "one" ).Material = materialone |
04 | child:FindFirstChild( "two" ).Material = materialtwo |
05 | child:FindFirstChild( "loit" ).PointLight.Enabled = lighting |
11 | wait(math.random( 10 , 14 )) |
13 | light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false ) |
16 | light(Enum.Material.Neon, Enum.Material.Neon, true ) |
19 | light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false ) |
22 | light(Enum.Material.Neon, Enum.Material.Neon, true ) |
25 | light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false ) |
26 | wait(math.random( 10 , 14 )) |
28 | light(Enum.Material.Neon, Enum.Material.Neon, true ) |