Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make a door that opens when five lights are activated? [closed]

Asked by
Qu_xtty -8
4 years ago

I don't have a clue on what to do.

0
I'm sorry but this isn't a request site. You either need to at least have a script with your own code on it or ask a question on how some part(s) of the API work. Reffer to the community guidelines. lazycoolboy500 597 — 4y
0
learn lua, theres ur answer, remember to upvote this if it helped xd greatneil80 2647 — 4y

Closed as Not Constructive by lazycoolboy500, Nguyenlegiahung, SmartNode, AspectW, PrismaticFruits, and Leamir

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
hallmk7 50
4 years ago

As per your question you want 5 lights whenever are activated, the door opens.

The following is not a script, but it will just give you an idea on how to go about it. You haven't even given any script for reference also, However i'll try my best to make you understand

1) Assign a variable, like ,

local lightsCount = 0

add 1 to it whenever a light is activated, such as

local lights = { game.Workspace.Lights:GetChildren()} --assuming that there are lights inside a model in workspace called 'lights'

For _, light in pairs (lights) do

If light.Activated == true then
lightsCount = lightsCount + 1 -- whenever a light is activated, it adds 1 to the variable.

2) Now check if there are 5 lights by,

If Lights == 5 then 
--Door then opens
Ad