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

Problems With Plane Light Control?

Asked by 8 years ago

Hello I am working a plane light control script I have everything set and look right. But in the output it says, STROBELIGHTS is Not a valid member of player. The function is when the script.Parents Background color is equal to a certain color the Lights come on.

Here is my code:

StrobeL = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.STROBELIGHTS.StrobeL.White.Light
StrobeR = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.STROBELIGHTS.StrobeR.White.Light
StrobeL2 = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.STROBELIGHTS.StrobeL2.White.Light
StrobeR2 = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.STROBELIGHTS.StrobeR2.White.Light
----------------------------------------
function On()
     script.Parent.BackgroundColor3 = Color3.new(0,255,0)
end

function Off()
     script.Parent.BackgroundColor3 = Color3.new(255,0,0)
end

-------------------------------------

if script.Parent.BackgroundColor3 == Color3.new(255,0,0) then
    StrobeL.ImageTransparency = 1
    StrobeR.ImageTransparency = 1
    StrobeL2.ImageTransparency = 1
    StrobeR2.ImageTransparency = 1
end

if script.Parent.BackgroundColor3 == Color3.new(0,255,0) then
    StrobeL.ImageTransparency = 0
    StrobeR.ImageTransparency = 0
    StrobeL2.ImageTransparency = 0
    StrobeR2.ImageTransparency = 0
end

-------------------------------------------
script.Parent.Parent.On.MouseButton1Down:connect(On)
script.Parent.Parent.Off.MouseButton1Down:connect(Off)

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

May I ask where your script is located? This seems to be a problem with the location of your script. You may actually directing the script to a completely different object! To put it into better terms, I'd recommend reorganizing your script; too many .Parent's arent exactly considered a healthy habit. Wish you luck! :)

Ad

Answer this question