How do i make a vehicle move once all seats in vehicle are filled with a player?


  •                         Ive tried many differnt ways but I dont know how to make the bus move once all 6 seats are filled with players. I want it so that once its filled with 6 people, it will move the bus, I have the script for the bus and ive tested it and it works, please if anybody could help out.
    
    
    
    
    seat1 = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat1
                                seat2 = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat2
                                seat3 = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat3
                                seat4 = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat4
                                seat5 = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat5
                                seat6 = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder.Seat6
    
                                  local SeatsFolder = game.Workspace.Bus1.Truck.VS3.Body.Seats.SeatsFolder
    
                                  local AvailableSeats = SeatsFolder:GetChildren()
    
                                 print(#AvailableSeats)
    
    
                                  repeat
                                    if seat1.Occupant~=nil then
    	                             table.remove(AvailableSeats,1)
    	                                          wait(1)
                                              else
    	wait(0.5)
    	 if seat2.Occupant~=nil then
    		table.remove(AvailableSeats,2)
    		wait(1)
    	else
    		wait(0.5)
    		if seat3.Occupant~=nil then
    			table.remove(AvailableSeats,3)
    			wait(1)
    		else
    			wait(0.5)
    			if seat4.Occupant~=nil then
    				table.remove(AvailableSeats,4)
    				wait(1)
    			else
    				wait(0.5)
    				if seat5.Occupant~=nil then
    					table.remove(AvailableSeats,5)
    					wait(1)
    				else
    					wait(0.5)
    					if seat6.Occupant~=nil then
    						table.remove(AvailableSeats,6)
    						wait(1)
    					else
    						wait(0.5)
    						end
    					end
    				end
    			end
    		end
    	end
                     until
             #AvailableSeats == 0
    
                    print(#AvailableSeats)
    
                    local function movebus()
                        wait(2)
                             for i = 0,-100,-.01 do
                                   game.Workspace.Bus1:TranslateBy(Vector3.new(0,0,i))
                                       wait(.01)
                                    end
                               end
    
    
                                         if #AvailableSeats >=6 then
                                    movebus()
    
                                 end

  • @unkown0611 This isn't the category to ask questions; this's the category to discuss, give suggestions and ideas towards the site. Even then, you should be making a question on the actual site, and not here.
    0_1556165256759_shcategory.png

  • Global Moderator

    I moved your first post to commons. Don't abuse categories. Don't make me move your posts a third time.

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.