In this script I'm trying to have a brick clicked and change color, but on output it said that Spotlight is not a valid member of Part
local isOn = false
local talk = script.Parent.talk
function on()
isOn = true
talk.Value = true
end
function off()
isOn = false
talk.Value = false
end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
local Spotlight = script.Parent.SpotLight
if isOn == true then Spotlight.Color = 255,58,24
end
if isOn == true then Spotlight.Color = 0,0,255
end
This is what the Part looks like
Part ClickDirector Script Spotlight talk

6 comments
It means that the thing called "SpotLight" is not in the hierarchy you put in the script
no, in part it there is ClickDirector, Script, Spotlight, and talk
Use WaitForChild on line 20 like so: local Spotlight = script.Parent:WaitForChild("SpotLight")
After your answer spongo now output said 18:48:27.682 - Color3 is not a valid member of SpotLight
Spotlight.Color = Color3.new(255,58,24) You need Color3.new. Use that for the other line.
Its still not working