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 open when five lights are neon/activated?

	ErnestaLightOn = false
	DanLight2On = false
	AquiziviteLight3On = false
	LovelyLightOn = false
	QuinnKennithLightOn = false
	 
	if ErnestaLightOn == true and DanLightOn == true and AquiziviteLightOn == true and LovelyLightOn == true and QuinnKennithLightOn == true then
		 local DarklightDoor = script.Parent
		 if game.Workspace.ActivationLights.Material == Enum.Material.Neon then
			game.Workspace.DarklightDoor.Transparency = 1 
			game.Workspace.DarklightDoor.CanCollide = false
			game.Workspace.PlayOpening()
		end
	end
end

If you know why this isn't working, post it in the answers. Anyways, here is an example of what I'm trying to do, so you can fix my script. I want the door to become transparent and CanCollide = false when ErnestaLight, DanLight, AquiziviteLIght, LovelyLight, and QuinnKennithLight are neon/activated. Please help! (For a myth game)

6 comments

0

Any information given in the output?

0

What do you mean Feahren?

0

are there any errors/ warinings?

0

the last end has a red line under it, and in the output it says "Workspace.DarklightDoor.Script:21 Expected got end

0

That means you're trying to close a scope that was never created; remove the third end keyword, there are only two if scopes.

0

But then two of the light names have a red underline under them.

1 answer

ErnestaLightOn = false
DanLight2On = false
AquiziviteLight3On = false
LovelyLightOn = false
QuinnKennithLightOn = false


if ErnestaLightOn == true and 
DanLightOn == true and
AquiziviteLightOn == true and
LovelyLightOn == true and
QuinnKennithLightOn == true then
    local DarklightDoor = script.Parent
     if game.Workspace.ActivationLights.Material == Enum.Material.Neon
        then game.Workspace.DarklightDoor.Transparency = 1 
        game.Workspace.DarklightDoor.CanCollide = false
        game.Workspace.PlayOpening()


    end
end

As we can see the top variables don't match the bottom one. When scripting you have to remember you are working with a robot so everything must match as it won't just go and fix a simple problem for you.

ErnestaLightOn = false
DanLightOn = false
AquiziviteLightOn = false
LovelyLightOn = false
QuinnKennithLightOn = false


if ErnestaLightOn == true and 
DanLightOn == true and
AquiziviteLightOn == true and
LovelyLightOn == true and
QuinnKennithLightOn == true then
    local DarklightDoor = script.Parent
     if game.Workspace.ActivationLights.Material == Enum.Material.Neon
        then game.Workspace.DarklightDoor.Transparency = 1 
        game.Workspace.DarklightDoor.CanCollide = false
        game.Workspace.PlayOpening()


    end
end

This is the fixed script unless you intentionally put the numbers into the script

2 comments

0

DanLight has a red underline under it.

0

Does the script run though, we need to see the error log you are receiving in order to fix the problem

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