✓ Accepted answer
REVISED Server Script
local Keycarddoor1 = workspace.Keycarddoor1
Keycarddoor1.BrickColor = BrickColor.new("Lime green")
local Keycarddoor2 = workspace.Keycarddoor2
Keycarddoor2.BrickColor = BrickColor.new("Lime green")
local Keycarddoor3 = workspace.Keycarddoor3
Keycarddoor3.BrickColor = BrickColor.new("Lime green")
local function Keycarddooropen1()
workspace.Keycarddooropen1.CanCollide = true
workspace.Keycarddooropen1.Transparency = 1
end
local Keycarddoorscript = {Keycarddoor1, Keycarddoor2, Keycarddoor3}
if Keycarddoorscript[1] and Keycarddoorscript[2] and Keycarddoorscript[3] then
Keycarddooropen1()
end
ERRORS
You cannot define a variable in the same line two different ways
local Keycarddoor1 = game.Workspace.Keycarddoor1.BrickColor == BrickColor.new("Lime green")
should be
local Keycarddoor1 = game.Workspace.Keycarddoor1
Keycarddoor1.BrickColor = BrickColor.new("Lime green")
To check if all the values are true, then you need brackets around the table
local Keycarddoorscript = Keycarddoor1, Keycarddoor2, Keycarddoor3
should be
local Keycarddoorscript = {Keycarddoor1, Keycarddoor2, Keycarddoor3}
You cant define the event's actions in a list, but you can use a local function to achieve the same end.
if Keycarddoorscript == true then
game.Workspace.Keycarddoor1.CanCollide = true, game.Workspace.Keycarddoor1.Transparency == 1
end
should be
if Keycarddoorscript[1] and Keycarddoorscript[2] and Keycarddoorscript[3] then
Keycarddooropen1()
end
You use the arguments [#] because you are going through table keyvalues
1 comment
Format your code!!!!