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 2 years ago
Edited 2 years 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"

01game.ReplicatedStorage["Light Settings"]["Left Lights"].OnServerEvent:Connect(function()
02    local Switch = script.Parent["Light Arrow"].Switch
03        while true do
04        wait(1)
05        while Switch.Value == true do
06                local ConLights = script.Parent["Light Arrow"]
07                for _, ConLights in ipairs(ConLights:GetChildren()) do
08            ConLights.Transparency = 0
09            wait(1)
10            ConLights.Transparency = 1
11 
12            end
13            end
14        end
15end)

Updated script

01game.ReplicatedStorage["Light Settings"]["Left Lights"].OnServerEvent:Connect(function()
02 
03    local Switch = script.Parent.Switch
04    local ConLights = script.Parent["Light Arrow"]:WaitForChild(script.Parent["Light Arrow"].LPart, 12)
05    while Switch.Value == true do
06        task.wait()
07        for _, ConLights in ipairs(script.Parent["Light Arrow"]:GetChildren()) do
08            ConLights.Transparency = 0
09            wait(1)
10            ConLights.Transparency = 1
11 
12            end
13        end
14end)

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

1 answer

Log in to vote
1
Answered by 2 years 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 — 2y
0
If that's the case, you should mark this answer as accepted. DindinYT37 246 — 2y
0
ok!! Then New post 666_brithday 103 — 2y
Ad

Answer this question