I am making a game where you have to survive until the escape helicopter arrives to pick you up but I have a script that runs the Intermission period and the game period but after the game starts I want it to “Activate” a script that teleports the escape helicopter to certain positions I here are the scripts:
local Map = game.ServerStorage.Map.Map
local ingame = game.Workspace.Map
local status = game.ReplicatedStorage.Values.RoundCounter
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local timeEvent = ReplicatedStorage.Events:WaitForChild('TimeEvent')
local function playGame()
local timeAmount = 300
local seconds = ' Seconds!'
local timerText = 'Escape Helicoper Arriving In: '
while timeAmount > 0 do
timeEvent:FireAllClients(timeAmount, timerText, seconds)
wait(1)
timeAmount -= 1
end
end
local function playIntermission()
local intermission = 138
local seconds = ' Seconds!'
local timerText = 'Game Starting In: '
while intermission > 0 do
timeEvent:FireAllClients(intermission, timerText, seconds)
wait(1)
intermission -= 1
end
end
while true do
playIntermission()
playGame()
end
This script basically runs the game function and the intermission function on a while loop but inside the “playGame” function I want it to wait until the time remaining is 90 seconds then maybe fire an event that triggers my teleport helicopter script and here is my Teleport helicopter script:
local status = game.ReplicatedStorage.Values.IsInRound
local status2 = game.ReplicatedStorage.Values.CameraChanger
local Event = game.ReplicatedStorage.Events.HeliMover
local Sound = game.Workspace.Helicopter
local ingame = game.ServerStorage.Heli.Helecopter:Clone()
if ingame.Parent == game.Workspace then
local Heli= game.Workspace.Helecopter
ingame.Parent = game.Workspace
ingame:MoveTo(Vector3.new(276.5, 71.5, -786))
wait(2)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -808)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -681.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -591.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -489)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -396)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -286.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 78.5, -167.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 43, -167.5)))
wait(45)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, -167.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, -77.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, -77.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, -38)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 93.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 93.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 163.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 231)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 313.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 392.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 496.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 496.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 690)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 797.5)))
wait(1.3)
ingame:SetPrimaryPartCFrame(CFrame.new(Vector3.new(265, 100.5, 881.5)))
status2.Value = true
print("COMPLETED HELICOPTER FLIGHT!")
if game.Workspace.Helicopter.IsPlaying then
Sound:Pause()
print("Sound Paused!")
end
wait(20)
ingame:Destroy()
end)
This script looks messy but all it does is teleport the helicopter to the positions, Sorry if this question is confusing thanks.