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

[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

01local 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
06    end
07end
08 
09while task.wait() do
10    print("a")
11    wait(math.random(10,14))
12    print("b")
13    light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false)
14    wait(.2)
15    print("c")
View all 29 lines...
1
either put [SOLVED] in title or remove it T3_MasterGamer 2189 — 2y
0
it broke lol JmoneyPlayzOfficial 49 — 2y
1
uhh are you sure you waited for 10-14 seconds? T3_MasterGamer 2189 — 2y
0
i waited around a minute but nothing happened JmoneyPlayzOfficial 49 — 2y

Answer this question