I want to make it so that when i click a light switch the light should toggle
objects : Light > PointLight
Second Object : LightSwitch(Model) > ClickDetector > LightControllerScript , BoolLight(BoolValue)
Parent Object : StartingArea(Model, Is a room)
LightControllerScript :
script.Parent.MouseClick:Connect(function()
if script.Parent.BoolLight.Value == true then
workspace.StartingArea.Light.PointLight.Brightness = 0
workspace.StartingArea.Light.Material = 'Glass'
script.Parent.BoolLight.Value = false
end
if script.Parent.BoolLight.Value == true then
workspace.StartingArea.Light.PointLight.Brightness = 1
workspace.StartingArea.Light.Material = 'Neon'
script.Parent.BoolLight.Value = false
end
print('Light has been triggered')
end)
Console : Light has been triggered
And yet Nothing happened to the light it still remains on and never changes

2 comments
I think the problem is that you have 2 if statements with the same condition
Thanks tuanorn! you were right i used an else statement and it suddenly worked Thank you so much!