This is the code that actually starts up the animations/spawning.
local module = {}
local currentround = 0
local initialSetup = script.RoundSetup
initialSetup.Parent = workspace
initialSetup.Enabled = true
local function SpawnLevel()
local x = require(game.ReplicatedStorage.TileModules.RoomManager)
local size = 50 + currentround * 15 + math.random(-10, 10)
return x.AddTile(size, Vector3.new(600, 200, -5.8))
end
local function SpawnAnimation()
local TS = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
local eventFind: RemoteEvent = rs:WaitForChild("GuiEntryEvent")
local event: RemoteEvent
if not rs:FindFirstChild("CamAnim") then
event = Instance.new("RemoteEvent")
event.Name = "CamAnim"
event.Parent = rs
else
event = rs.CamAnim
end
local function Music()
local tpm = script.TeleportMusic
tpm["Wind fall"].Volume = 0; tpm["Wind fall"]:Play(); tpm["Wind fall"].PlaybackSpeed = 0.4;
TS:Create(tpm["Wind fall"], TweenInfo.new(5), {Volume = 1.4}):Play()
TS:Create(tpm["Wind fall"], TweenInfo.new(16.3), {PlaybackSpeed = 4}):Play()
for _, v in tpm.Ambiances:GetChildren() do
v.Volume = 0; v:Play();
TS:Create(v, TweenInfo.new(0.2), {Volume = 0.95}):Play()
task.wait(0.1)
end
task.wait(5)
tpm.Screeching[math.random(1, #tpm.Screeching:GetChildren())]:Play()
task.wait(5)
tpm.JustScreaming:Play()
TS:Create(tpm.JustScreaming, TweenInfo.new(6), {Volume = 0}):Play()
task.wait(3)
TS:Create(tpm["Wind fall"], TweenInfo.new(2), {Volume = 0}):Play()
task.wait(3); tpm["Wind fall"]:Stop();
for _, v in tpm.Ambiances:GetChildren() do
v:Stop();
end
for _, v in tpm.Screeching:GetChildren() do
v:Stop();
end
tpm.Fall:Play()
task.wait(0.15)
tpm["Body Fall"]:Play()
task.wait(0.15)
for _, v in tpm.FallenAmbiance:GetChildren() do
v.Volume = 1; v:Play();
task.wait(0.15)
end
end
event:FireAllClients(16.5)
eventFind:FireAllClients(script.WhiteThing, 16)
Music()
end
local function FastSpawnAnimation()
local TS = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
local eventFind: RemoteEvent = rs:WaitForChild("GuiEntryEvent")
local event: RemoteEvent
if not rs:FindFirstChild("CamAnim") then
event = Instance.new("RemoteEvent")
event.Name = "CamAnim"
event.Parent = rs
else
event = rs.CamAnim
end
local function Music()
local tpm = script.TeleportMusic
tpm["Wind fall"].Volume = 0; tpm["Wind fall"]:Play(); tpm["Wind fall"].PlaybackSpeed = 0.4;
TS:Create(tpm["Wind fall"], TweenInfo.new(5), {Volume = 1.4}):Play()
TS:Create(tpm["Wind fall"], TweenInfo.new(6.3), {PlaybackSpeed = 4}):Play()
for _, v in tpm.Ambiances:GetChildren() do
v.Volume = 0; v:Play();
TS:Create(v, TweenInfo.new(0.2), {Volume = 0.95}):Play()
task.wait(0.1)
end
task.wait(1)
tpm.Screeching[math.random(1, #tpm.Screeching:GetChildren())]:Play()
task.wait(1)
tpm.JustScreaming:Play()
TS:Create(tpm.JustScreaming, TweenInfo.new(6), {Volume = 0}):Play()
task.wait(1)
TS:Create(tpm["Wind fall"], TweenInfo.new(2), {Volume = 0}):Play()
task.wait(3); tpm["Wind fall"]:Stop();
for _, v in tpm.Ambiances:GetChildren() do
v:Stop();
end
for _, v in tpm.Screeching:GetChildren() do
v:Stop();
end
tpm.Fall:Play()
task.wait(0.15)
tpm["Body Fall"]:Play()
task.wait(0.15)
for _, v in tpm.FallenAmbiance:GetChildren() do
v.Volume = 1; v:Play();
task.wait(0.15)
end
end
event:FireAllClients(6.5)
eventFind:FireAllClients(script.WhiteThing, 6)
Music()
end
local function addTablet ()
game.ReplicatedStorage.AddTab:FireAllClients()
game.ReplicatedStorage.foundRoomsReset:FireAllClients()
end
function module.TPPlayers()
game:GetService("ReplicatedStorage").MainGui:FireAllClients(false)
task.spawn(function()
SpawnLevel()
end)
task.wait(5)
local rm : Model = game.Workspace.TiledRooms:FindFirstChild("StartRoom0")
local newAnimThing = game:GetService("ReplicatedStorage"):FindFirstChild("FallAnimPt"):Clone()
newAnimThing.Parent = rm
newAnimThing:PivotTo(rm:FindFirstChild("UniPart").CFrame)
newAnimThing:FindFirstChild("Script").Enabled = true
for _, v in game.Players:GetChildren() do
if v.Character then
local hum = v.Character:FindFirstChild("HumanoidRootPart")
if hum then
hum.Anchored = true
task.spawn(function()
hum.CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 1000, 0)
game:GetService("TweenService"):Create(hum, TweenInfo.new(16, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 0.75, 0)}):Play()
task.wait(14)
hum.Anchored = false
end)
end
end
end
task.spawn(function()
SpawnAnimation()
newAnimThing:Destroy()
game:GetService("ReplicatedStorage").MainGui:FireAllClients(true)
addTablet()
end)
end
function module.FastSpawn ()
game:GetService("ReplicatedStorage").MainGui:FireAllClients(false)
task.spawn(function()
SpawnLevel()
end)
task.wait(5)
local rm : Model = game.Workspace.TiledRooms:FindFirstChild("StartRoom0")
local newAnimThing = game:GetService("ReplicatedStorage"):FindFirstChild("FallAnimPt"):Clone()
newAnimThing.Parent = rm
newAnimThing:PivotTo(rm:FindFirstChild("UniPart").CFrame)
newAnimThing:FindFirstChild("Script").Enabled = true
for _, v in game.Players:GetChildren() do
if v.Character then
local hum = v.Character:FindFirstChild("HumanoidRootPart")
if hum then
hum.Anchored = true
task.spawn(function()
hum.CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 500, 0)
game:GetService("TweenService"):Create(hum, TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 0.75, 0)}):Play()
task.wait(6)
hum.Anchored = false
end)
end
end
end
task.spawn(function()
FastSpawnAnimation()
newAnimThing:Destroy()
game:GetService("ReplicatedStorage").MainGui:FireAllClients(true)
addTablet()
end)
end
return module
– IN STUDIO
– IN CLIENT