if it’s a BoolValue you need to reference On.Value = true and not On = True as On is the instance itself and Value is the container for the instances’ type
Value1 is not a valid member of TextButton "Players.Valkyrop.PlayerGui.ScreenGui.Frame.Buttons.1"
The reason, is simply because you’re trying to set an instance to a bool value, which you can’t. You always have to set the instance’s value ,and not the instance itself.
To solve this :
Simply add .Value after On.
function OnClicked()
script.Parent.Parent.Parent.Parent.Body.Lights.On.Value = true
end
script.Parent.MouseButton1Down:connect(OnClicked)
function OnClicked()
script.Parent.Parent.Parent.Parent.Body.Lights.On.Value = false
end
script.Parent.MouseButton1Down:connect(OnClicked)
There is also a shorter way to do all of that, which is simplier -
function OnClicked()
local var = script.Parent.Parent.Parent.Parent.Body.Lights.On
var.Value = not var.Value
end
script.Parent.MouseButton1Down:connect(OnClicked)
This line - var.Value = not var.Value will simply turn it the ‘On’ value to false/true accordingly to its current status[meaning, if it’s true, it’ll set it to false, vice versa]
Use this short-cut if you’re using the same button.