How to Make a Light Switch
Download – Light Switch Model and Script
How To – Make a Light Switch on Roblox Studio
What’s up everyone welcome to buzzygames, my name is BuzzyGamesBeth and today I’ll be teaching you how to make a clickable light switch!
- Right now I have the most basic house ever and it’s pretty dark if we go inside of it
- What I want to do is go ahead and create a part that is going to be our light switch. It’s going to be a simple one for me, you guys can make this as fancy as you want. I’ll have the light switch by the door- yeah it looks pretty good, that’s good enough!
- Alrighty so now that we have our light switch we need to have our source of light or the part that is going to be the source of light when we code it. All we’re going to do is just grab a partand i’m going to go ahead and make it as big as the the house. I’m gonna make it transparent- change the transparency to one and then i’m gonna go ahead and bring it up on the roof like about there, yeah that looks pretty good! Sweet so now i’m going to rename this part to “luminate”. I’ll be referencing this in my script in just a second
- Inside of our switch, we’re gonna rename that to switch. Inside of our switch we’re gonna add a click detector and a script
- Once we have our print statement deleted we’re going to go ahead and define our variables so the variable the part that we want to turn on is the “Luminate” part so I created a variable for that.
- We’re going to go ahead and create a function where anytime if we click the switch button, then the light is going to turn on! I’m going to set the properties of the light and the brightness of it, you can change this brightness value to howeve rbright you want- i’m going to set it to 25 and then else if we click the light switch again then it’s going to destroy the light or just simply turn it off.
- I’m going to go ahead and call my function and that’s it! So now i’m just going to go ahead and hop into my game, walk inside of my house- pretty dark! If I go ahead and press the red button, boom, it turns on!