Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Problems With Plane Light Control?

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

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! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.