I have no idea why this does not work, so please if you know why tell me.
Read bellow before trying to search the script for problems.
Let me explain:
This is a test script for an elevator
the last 3 lines are the 3 buttons for the elevator (A button is inside it and the other 2 are outside the elevator on the wall)
The first line where:
script.Parent.Buttons.Main.ProximityPrompt.Triggered:Connect(OnTrigger)
is the problem (probably)
So everything works except that when the elevator is up and should go down.
It works when the elevator is down and it goes up
But not working when its supposed to go down
However it works from the other buttons as it should.
local function OnTrigger() if IsUp == false then script.Parent.Buttons.Main.ProximityPrompt.Enabled = false script.Parent.Parent.DoorSet1.button.ProximityPrompt.Enabled = false script.Parent.Parent.DoorSet2.button.ProximityPrompt.Enabled = false goup:Play() goup.Completed:Connect(function() IsUp = true script.Parent.Buttons.Main.ProximityPrompt.Enabled = true script.Parent.Parent.DoorSet2.button.ProximityPrompt.Enabled = true script.Parent.Parent.DoorSet1.button.ProximityPrompt.Enabled = true end) else script.Parent.Buttons.Main.ProximityPrompt.Enabled = false script.Parent.Parent.DoorSet1.button.ProximityPrompt.Enabled = false script.Parent.Parent.DoorSet2.button.ProximityPrompt.Enabled = false godown:Play() godown.Completed:Connect(function() print("completed") IsUp = false script.Parent.Buttons.Main.ProximityPrompt.Enabled = true script.Parent.Parent.DoorSet2.button.ProximityPrompt.Enabled = true script.Parent.Parent.DoorSet1.button.ProximityPrompt.Enabled = true end) end end script.Parent.Buttons.Main.ProximityPrompt.Triggered:Connect(OnTrigger) script.Parent.Parent.DoorSet2.button.ProximityPrompt.Triggered:Connect(OnTrigger) script.Parent.Parent.DoorSet1.button.ProximityPrompt.Triggered:Connect(OnTrigger)