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

How can I get a 4 door sequence to work continuously?

Asked by
Burobuu 18
5 years ago
Edited 5 years ago

I have 4 doors, all working to allow a coaster to stop, then go.

DoorB is the boost door, it holds the coaster in place for 5 seconds then lets it go on the boost rail. DoorE is the door that holds the coaster in place for riders to board. DoorO is the other door that holds the coaster in place for riders to exit. DoorR is just the door that allows players to jump and senses when DoorO should began counting down.

So first I would have DoorE wait for riders to board then allow the cart to continue to door B, doorB would then signal the music and countdown(linked with audio) to allow the coaster to continue to the boost rail.(The coaster would then go along the rails) Soon after the coaster would end up back at DoorR. I was trying to set it up so once DoorR was touched, DoorO would wait a certain time and then let riders continue, soon after the process would start again using a while true statement.

Heres my script.

script.Parent.DoorE.CanCollide = true
script.Parent.DoorO.CanCollide = true
script.Parent.DoorR.CanCollide = false
script.Parent.DoorB.CanCollide = true
script.Parent.Parent.Parent.Train.Car2.Floor.Sound.Volume = 2
script.Parent.Parent.Parent.Train.Car2.Floor.Sound.SoundId = "rbxassetid://1381369139"
BoardingTime = 20

while true do

wait(BoardingTime)
    script.Parent.DoorE.CanCollide = false
wait(8)
    script.Parent.DoorE.CanCollide = true
wait(2)
    script.Parent.Parent.Parent.Train.Car2.Floor.Sound.Volume = 2
    script.Parent.Parent.Parent.Train.Car2.Floor.Sound:Play()
wait(4.5)
    script.Parent.DoorB.CanCollide = false
wait(5)
    script.Parent.DoorB.CanCollide = true
script.Parent.DoorR.Touched:connect(function(hit)
    script.Parent.DoorO.CanCollide = true
    script.Parent.Parent.Parent.Train.Car2.Floor.Sound.Volume = 1.5
wait(.1)
    script.Parent.Parent.Parent.Train.Car2.Floor.Sound.Volume = 1
wait(.1)
    script.Parent.Parent.Parent.Train.Car2.Floor.Sound.Volume = .5
wait(.1)
    script.Parent.Parent.Parent.Train.Car2.Floor.Sound.Volume = .2
wait(BoardingTime)
    script.Parent.DoorO.CanCollide = false
wait(8)
    script.Parent.DoorO.CanCollide = true
    end)    
end
0
We only help people with properly indented code User#19524 175 — 5y
0
Oml that code, so messy, try indenting. mixgingengerina10 223 — 5y
0
What would properly indented code look like? Burobuu 18 — 5y
0
just press tab to indent code User#23365 30 — 5y
View all comments (2 more)
0
wont work on this mac Burobuu 18 — 5y
1
@incapaz, While non-indented code is harder to read, it isn't fair that we shun the person completely. They need assistance just as much as any other asker on this site needs. Plus, saying that can give his website a bad impression. EzraNehemiah_TF2 3552 — 5y

Answer this question