Building Lighting System

Wanted to share my new lighting system I made for my buildings. It’s nothing too fancy but It’s my first time trying it.

Lights use a switch that moves when turned on or off

Fuse box in the back controls main power. Door and switch both move. When turned off, lights turn off and power does not work. When turned on, lights come on and switch works again.

Link: https://media.giphy.com/media/1HKP76624c5Y8soqyh/giphy.gif

4 Likes
local clickdetecktor = --you‘re clickdetector
local light = --you‘re light

local on = false --is light ob

clickdetector.Click:Connect(function()
    on = not on --makes on from true to false and from false to true
    light.Enabled = on
end)

Please Solution if it helped :smiley:

Everything already works. This was just me showing it working but thanks for the recommendation.

4 Likes

I’m impressed by the lighting system, it’s pretty cool and I would love to implement that to one of my games in the future.

Your post is a bit confusing since the giphy link being labeled as “example” seems as if you’re asking for help, just a note :+1:

1 Like

is it a local script or is it a script?

No, it is only a Server Script :page_facing_up:

mmm I think the script has an error although I put the light on it, it doesn’t work

robloxapp-20201019-1153242.wmv (2.6 MB)

Replace the first two lines with this:

local clickdetecktor = --you‘re clickdetector

After the „=“ put the path to the clickdetector! Example:

local clickdetecktor = script.Parent.ClickDetecktor
local light = --you‘re light

same as before here

ok can you show me an example of how it works? please is that I am new :grinning:

Full Model? Or just the script

Only Script: Now :clock1: Full Model: Tomorrow :clock1030:

the complete model and how it works

pls do not talk that here , i think it is inaproproate because this post is only for feedhback on the original poster’s cool creation and not anything else,

anyway i think the lighting system is pretty cool, and the logic behind the lighting script can probly be used for something else other than light switch , like for a puzzle game or something? i think that could be cool to see.