Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

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.

0

learn lua, theres ur answer, remember to upvote this if it helped xd

1 answer

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.
  1. Now check if there are 5 lights by,
If Lights == 5 then 
--Door then opens

This discussion is preserved as it was. New answers, comments, and votes are closed.