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

I am trying to script an elevator door and cant get it to work. What do I do?

Asked by 4 years ago

Here is the code. Pls respond ASAP!!

local door = script.Parent.Door

local function openelevator () door.CanCollide = false door.Transparency = .5 door.BrickColor = BrickColor.new ("Bright green") end

local function closeelevator () door.CanCollide = true door.Transparency = 0 door.BrickColor = BrickColor.new ("Black") end

while true do openelevator() wait (3) closeelevator() end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

On your while true do loop, it opens the elevator doors then it waits 3 seconds and then closes the doors and then instantly opens them. This is probably happening so fast that you don't see it actually closing. This is the fixed version.


local door = script.Parent.Door local function openelevator() door.CanCollide = false door.Transparency = .5 door.BrickColor = BrickColor.new("Bright green") end local function closeelevator() door.CanCollide = true door.Transparency = 0 door.BrickColor = BrickColor.new("Black") end while true do openelevator() wait(3) -- Time to wait until doors close closeelevator() wait(2) -- Time to wait for doors to open end
Ad

Answer this question