You can write your topic however you want, but you need to answer these questions:
An system similar to airplane 1 (the story game) Keep it simple and clear!
My code keeps throwing errors as shown in the screenshots Include screenshots / videos if possible!
Doing what the tooltips said, didn’t work. Did you look for solutions on the Developer Hub?
Below is the code I have made, I seriously have no idea how to fix this, my brain is deformed.
local TS = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local placeId = "6330481307"
local leaveGuiEvent = game.ReplicatedStorage.LeaveGuiEvent
local TransitionEvent = game.ReplicatedStorage.TransitionEvent
local list = {}
local gui = script.Parent.GuiPart.SurfaceGui
local billboard = script.Parent.billboardPart.billboardGui
local timer
local teleporting = false
local function updateGui()
gui.Frame.players.Text = #list
billboard.Frame.players.Text = #list
end
local function removeFromList(character)
for i=1,#list do
if list[i] == character.Name then
table.remove(list,i)
updateGui()
end
end
end
local function teleportPlayers()
if #list > 0 then
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "TELEPORTING"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(1,0,0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
teleporting = true
TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
repeat wait() until #list <= 0
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "READY"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(34/255,255/255,20/255)
teleporting = false
end
end
script.Parent.Gate.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local alreadyExists = false
local char = hit.Parent
if plr then
-- Find seat
local AirportSeats = script.Parent.Parent.SeatsA.Seats:GetChildren()
for i, v in pairs(AirportSeats) do
if not v.Occupant then
-- Seat the player in the seat
v:Sit(plr.Character.Humanoid)
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 16 then
table.insert(list,char.Name)
char.PrimaryPart.CFrame = game.Workspace.Lobby.ExitPart.CFrame
updateGui()
leaveGuiEvent:FireClient(plr)
end
plr.Character.Humanoid.JumpPower = 0
plr.Character.Humanoid.WalkSpeed = 0
game.ReplicatedStorage.LeaveGuiEvent:FireClient(plr)
removeFromList(plr)
break
end
end
end
end
leaveGuiEvent.OnServerEvent:Connect(function(player)
if player.Character then
player.Character.Humanoid.Sit = false
player.Character.HumanoidRootPart.Anchored = false
wait()
player.Character.Humanoid.Jump = true
wait()
player.Character.PrimaryPart.CFrame = workspace.Lobby.ExitPart.CFrame
player.Character.Humanoid.Jump = true
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.JumpPower = 50
removeFromList(player.Character)
end
end)
while wait() do
timer = 31
for i=1,timer do
end
timer = timer - 1
gui.Frame.time.Text = timer
billboard.Frame.time.Text = timer
wait(1)
end
teleportPlayers()
end
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
local TS = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local placeId = "6330481307"
local leaveGuiEvent = game.ReplicatedStorage.LeaveGuiEvent
local TransitionEvent = game.ReplicatedStorage.TransitionEvent
local list = {}
local gui = script.Parent.GuiPart.SurfaceGui
local billboard = script.Parent.billboardPart.billboardGui
local timer
local teleporting = false
local function updateGui()
gui.Frame.players.Text = #list
billboard.Frame.players.Text = #list
end
local function removeFromList(character)
for i=1,#list do
if list[i] == character.Name then
table.remove(list,i)
updateGui()
end
end
end
local function teleportPlayers()
if #list > 0 then
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "TELEPORTING"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(1,0,0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
teleporting = true
TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
repeat wait() until #list <= 0
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "READY"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(34/255,255/255,20/255)
teleporting = false
end
end
script.Parent.Gate.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local alreadyExists = false
local char = hit.Parent
if plr then
-- Find seat
local AirportSeats = script.Parent.Parent.SeatsA.Seats:GetChildren()
for i, v in pairs(AirportSeats) do
if not v.Occupant then
-- Seat the player in the seat
v:Sit(plr.Character.Humanoid)
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 16 then
table.insert(list,char.Name)
char.PrimaryPart.CFrame = game.Workspace.Lobby.ExitPart.CFrame
updateGui()
leaveGuiEvent:FireClient(plr)
end
plr.Character.Humanoid.JumpPower = 0
plr.Character.Humanoid.WalkSpeed = 0
game.ReplicatedStorage.LeaveGuiEvent:FireClient(plr)
removeFromList(plr)
break
end
end
end
end
leaveGuiEvent.OnServerEvent:Connect(function(player)
if player.Character then
player.Character.Humanoid.Sit = false
player.Character.HumanoidRootPart.Anchored = false
wait()
player.Character.Humanoid.Jump = true
wait()
player.Character.PrimaryPart.CFrame = workspace.Lobby.ExitPart.CFrame
player.Character.Humanoid.Jump = true
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.JumpPower = 50
removeFromList(player.Character)
end
end)
while wait() do
timer = 31
for i=1,timer do
end
timer = timer - 1
gui.Frame.time.Text = timer
billboard.Frame.time.Text = timer
wait(1)
end
teleportPlayers()
end)
local TS = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local placeId = "6330481307"
local leaveGuiEvent = game.ReplicatedStorage.LeaveGuiEvent
local TransitionEvent = game.ReplicatedStorage.TransitionEvent
local list = {}
local gui = script.Parent.GuiPart.SurfaceGui
local billboard = script.Parent.billboardPart.billboardGui
local timer
local teleporting = false
local function updateGui()
gui.Frame.players.Text = #list
billboard.Frame.players.Text = #list
end
local function removeFromList(character)
for i=1,#list do
if list[i] == character.Name then
table.remove(list,i)
updateGui()
end
end
end
local function teleportPlayers()
if #list > 0 then
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "TELEPORTING"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(1,0,0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
teleporting = true
TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
repeat wait() until #list <= 0
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "READY"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(34/255,255/255,20/255)
teleporting = false
end
end
script.Parent.Gate.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local alreadyExists = false
local char = hit.Parent
if plr then
-- Find seat
local AirportSeats = script.Parent.Parent.SeatsA.Seats:GetChildren()
for i, v in pairs(AirportSeats) do
if not v.Occupant then
-- Seat the player in the seat
v:Sit(plr.Character.Humanoid)
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 16 then
table.insert(list,char.Name)
char.PrimaryPart.CFrame = game.Workspace.Lobby.ExitPart.CFrame
updateGui()
leaveGuiEvent:FireClient(plr)
end
plr.Character.Humanoid.JumpPower = 0
plr.Character.Humanoid.WalkSpeed = 0
game.ReplicatedStorage.LeaveGuiEvent:FireClient(plr)
removeFromList(plr)
break
end
end
end
end
leaveGuiEvent.OnServerEvent:Connect(function(player)
if player.Character then
player.Character.Humanoid.Sit = false
player.Character.HumanoidRootPart.Anchored = false
wait()
player.Character.Humanoid.Jump = true
wait()
player.Character.PrimaryPart.CFrame = workspace.Lobby.ExitPart.CFrame
player.Character.Humanoid.Jump = true
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.JumpPower = 50
removeFromList(player.Character)
end
end)
while wait() do
timer = 31
for i=1,timer do
end
timer = timer - 1
gui.Frame.time.Text = timer
billboard.Frame.time.Text = timer
wait(1)
end
teleportPlayers()
end)
local TS = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local placeId = "6330481307"
local leaveGuiEvent = game.ReplicatedStorage.LeaveGuiEvent
local TransitionEvent = game.ReplicatedStorage.TransitionEvent
local list = {}
local gui = script.Parent.GuiPart.SurfaceGui
local billboard = script.Parent.billboardPart.billboardGui
local timer
local teleporting = false
local function updateGui()
gui.Frame.players.Text = #list
billboard.Frame.players.Text = #list
end
local function removeFromList(character)
for i=1,#list do
if list[i] == character.Name then
table.remove(list,i)
updateGui()
end
end
end
local function teleportPlayers()
if #list > 0 then
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "TELEPORTING"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(1,0,0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
teleporting = true
TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
repeat wait() until #list <= 0
script.Parent.GuiPart.SurfaceGui.Frame.Status.Text = "READY"
script.Parent.GuiPart.SurfaceGui.Frame.Status.TextColor3 = Color3.new(34/255,255/255,20/255)
teleporting = false
end
end
script.Parent.Gate.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local alreadyExists = false
local char = hit.Parent
if plr then
-- Find seat
local AirportSeats = script.Parent.Parent.SeatsA.Seats:GetChildren()
for i, v in pairs(AirportSeats) do
if not v.Occupant then
-- Seat the player in the seat
v:Sit(plr.Character.Humanoid)
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 16 then
table.insert(list,char.Name)
char.PrimaryPart.CFrame = game.Workspace.Lobby.ExitPart.CFrame
updateGui()
leaveGuiEvent:FireClient(plr)
end
plr.Character.Humanoid.JumpPower = 0
plr.Character.Humanoid.WalkSpeed = 0
game.ReplicatedStorage.LeaveGuiEvent:FireClient(plr)
removeFromList(plr)
break
end
end
end
end
end)
leaveGuiEvent.OnServerEvent:Connect(function(player)
if player.Character then
player.Character.Humanoid.Sit = false
player.Character.HumanoidRootPart.Anchored = false
wait()
player.Character.Humanoid.Jump = true
wait()
player.Character.PrimaryPart.CFrame = workspace.Lobby.ExitPart.CFrame
player.Character.Humanoid.Jump = true
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.JumpPower = 50
removeFromList(player.Character)
end
end)
while wait() do
timer = 31
for i=1,timer do
timer = timer - 1
gui.Frame.time.Text = timer
billboard.Frame.time.Text = timer
wait(1)
end
teleportPlayers()
end