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

? Transparency is not a valid member of BoolValue "Workspace.Construction ?

Asked by 1 year ago
Edited 1 year ago

I want all my lights to turn on and off if Switch = true Error I get Transparency is not a valid member of BoolValue "Workspace.Construction lights.Light Arrow.Switch"

game.ReplicatedStorage["Light Settings"]["Left Lights"].OnServerEvent:Connect(function()
    local Switch = script.Parent["Light Arrow"].Switch
        while true do
        wait(1)
        while Switch.Value == true do
                local ConLights = script.Parent["Light Arrow"]
                for _, ConLights in ipairs(ConLights:GetChildren()) do
            ConLights.Transparency = 0
            wait(1)
            ConLights.Transparency = 1

            end
            end
        end
end)

Updated script

game.ReplicatedStorage["Light Settings"]["Left Lights"].OnServerEvent:Connect(function()

    local Switch = script.Parent.Switch
    local ConLights = script.Parent["Light Arrow"]:WaitForChild(script.Parent["Light Arrow"].LPart, 12)
    while Switch.Value == true do
        task.wait()
        for _, ConLights in ipairs(script.Parent["Light Arrow"]:GetChildren()) do 
            ConLights.Transparency = 0
            wait(1)
            ConLights.Transparency = 1

            end
        end
end)

If you need a screenshot of what the explorer looks like let me know.

1 answer

Log in to vote
1
Answered by 1 year ago

As we don't know about the structure of your workspace, it's somewhat hard to identify the exact issue. Though, I have some ideas:

  • You use the same ConLights variable-name for both script.Parent["Light Arrow"] and its Child-instances.
  • It could be that one of the children in script.Parent["Light Arrow"] is a BoolValue, this can be solved by using :IsA("BasePart"). Assuming that the BoolValue is also a child of script.Parent["Light Arrow"], using the Error as source, it's probably what's causing the error.
  • Generally speaking, there's also the issue that you use nested while loops. Even though this isn't necessarily a problem (as far as I know), it is (in my opinion) bad practice.
0
Thx for your help I finally got the error removed but all the parts in ["Light Arrow"] which is a model within a model I updated my script with the new code 666_brithday 103 — 1y
0
If that's the case, you should mark this answer as accepted. DindinYT37 246 — 1y
0
ok!! Then New post 666_brithday 103 — 1y
Ad

Answer this question