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 1 year ago
Edited 1 year 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

local function light(materialone, materialtwo, lighting)
    for _, child in ipairs(script.Parent:GetChildren()) do
        child:FindFirstChild("one").Material = materialone
        child:FindFirstChild("two").Material = materialtwo
        child:FindFirstChild("loit").PointLight.Enabled = lighting
    end
end

while task.wait() do
    print("a")
    wait(math.random(10,14))
    print("b")
    light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false)
    wait(.2)
    print("c")
    light(Enum.Material.Neon, Enum.Material.Neon, true)
    wait(.2)
    print("d")
    light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false)
    wait(.2)
    print("e")
    light(Enum.Material.Neon, Enum.Material.Neon, true)
    wait(.2)
    print("f")
    light(Enum.Material.SmoothPlastic, Enum.Material.SmoothPlastic, false)
    wait(math.random(10,14))
    print("g")
    light(Enum.Material.Neon, Enum.Material.Neon, true)
end 


1
either put [SOLVED] in title or remove it T3_MasterGamer 2189 — 1y
0
it broke lol JmoneyPlayzOfficial 49 — 1y
1
uhh are you sure you waited for 10-14 seconds? T3_MasterGamer 2189 — 1y
0
i waited around a minute but nothing happened JmoneyPlayzOfficial 49 — 1y

Answer this question