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

6 comments

0

We only help people with properly indented code

0

Oml that code, so messy, try indenting.

0

What would properly indented code look like?

0

just press tab to indent code

0

wont work on this mac

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.