Advertisement
IHATEMICROWAVEOVEN

Title Screen before I ruin it

Jan 24th, 2023
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.71 KB | None | 0 0
  1. local ContentProvider = game:GetService("ContentProvider")
  2. local TweenService = game:GetService("TweenService")
  3. local Players = game:GetService("Players")
  4. local RunService = game:GetService("RunService")
  5.  
  6. -- Wait module (by Pyseph) below
  7. local o_clock = os.clock
  8. local c_yield = coroutine.yield
  9. local c_running = coroutine.running
  10. local c_resume = coroutine.resume
  11.  
  12. local Yields = {}
  13. RunService.Stepped:Connect(function()
  14. local Clock = o_clock()
  15. for Idx, data in next, Yields do
  16. local Spent = Clock - data[1]
  17. if Spent >= data[2] then
  18. Yields[Idx] = nil
  19. c_resume(data[3], Spent, Clock)
  20. end
  21. end
  22. end)
  23.  
  24. local function wait(Time)
  25. Time = (type(Time) ~= 'number' or Time < 0) and 0 or Time
  26. table.insert(Yields, {o_clock(), Time, c_running()})
  27. return c_yield()
  28. end
  29. -- Wait module (by Pyseph) above
  30.  
  31. game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. local function CharSelect()
  40. -- empty lol
  41.  
  42. print("Rorschach in Danmaku")
  43. end
  44.  
  45. local function TitleTransition() -- This transitions from LoadingScreen to TitleScreen
  46. local canvas = script.Parent.Title
  47. canvas.BackgroundTransparency = 0
  48. canvas.BackgroundColor3 = Color3.new(0.176,0.176,0.176)
  49. for _, i in pairs(canvas:GetChildren()) do
  50. i.Visible = false
  51. end
  52. canvas.LogoLabel.Visible = true
  53. canvas.LogoLabel.Position = UDim2.new(1.018, 0, 0.169, 0) -- Once title is adjusted, you should change this
  54.  
  55. local fade = TweenService:Create(canvas,TweenInfo.new(2),{BackgroundColor3 = Color3.new(0,0,0)})
  56. local white = TweenService:Create(script.Parent.OnTop,TweenInfo.new(1),{BackgroundTransparency = 0})
  57. local restore = TweenService:Create(script.Parent.OnTop,TweenInfo.new(1),{BackgroundTransparency = 1})
  58.  
  59. fade.Completed:Connect(function()
  60. wait(3)
  61. canvas.LogoLabel:TweenPosition(UDim2.new(0.018, 0, 0.169, 0), "Out", "Linear", 0.5, true, function() -- this too
  62. script.Parent.OnTop.Visible = true
  63. white:Play()
  64. end)
  65. end)
  66.  
  67. white.Completed:Connect(function()
  68. canvas.BackgroundTransparency = 1
  69. restore:Play()
  70. for _, i in pairs(canvas:GetChildren()) do
  71. i.Visible = true
  72. end
  73. for i = 1, 50 do
  74. canvas.Position = UDim2.new(math.random(-5,5)/(60+i), 0, math.random(-5,5)/(60+i), 0)
  75. wait(1/40)
  76. end
  77. canvas.Position = UDim2.new(0, 0, 0, 0)
  78. end)
  79.  
  80. restore.Completed:Connect(function()
  81. script.Parent.OnTop.Visible = false
  82. end)
  83.  
  84. fade:Play() -- Mostly done. Update LogoLabel position when adjusting time comes
  85. end
  86.  
  87. local function TitleScreen(bool) -- Creates main title screen
  88.  
  89. if bool then
  90. TitleTransition()
  91. end
  92.  
  93. local canvas = script.Parent.Title
  94. canvas.Visible = true
  95.  
  96. canvas.PlayButton.MouseButton1Up:Connect(function()
  97. --transition ig
  98. CharSelect()
  99. end)
  100.  
  101. end
  102.  
  103. local function LoadingScreen() -- Loads assets upon first joining
  104.  
  105. script.Parent.Title.Visible = false -- Mostly done. Add things to priority assets later.
  106.  
  107. local canvas = script.Parent.Loading
  108. canvas.Visible = true
  109.  
  110. -- create loading screen components
  111. local prioritylabel = Instance.new("TextLabel", canvas)
  112. prioritylabel.Position = UDim2.new(0, 0, 0, 0)
  113. prioritylabel.Size = UDim2.new(0.981, 0, 0.96, -20)
  114. prioritylabel.BackgroundTransparency = 1
  115. prioritylabel.BorderSizePixel = 0
  116. prioritylabel.Text = "Menu loading hasn't started yet."
  117. prioritylabel.TextSize = 10
  118. prioritylabel.TextXAlignment = "Right"
  119. prioritylabel.TextYAlignment = "Bottom"
  120. prioritylabel.TextColor3 = Color3.new(1,1,1)
  121. local normallabel = Instance.new("TextLabel", canvas)
  122. normallabel.Position = UDim2.new(0, 0, 0, 0)
  123. normallabel.Size = UDim2.new(0.981, 0, 0.96, 0)
  124. normallabel.BackgroundTransparency = 1
  125. normallabel.BorderSizePixel = 0
  126. normallabel.Text = "General loading hasn't started yet."
  127. normallabel.TextSize = 10
  128. normallabel.TextXAlignment = "Right"
  129. normallabel.TextYAlignment = "Bottom"
  130. normallabel.TextColor3 = Color3.new(1,1,1)
  131. local startbutton = Instance.new("TextButton", canvas)
  132. startbutton.Position = UDim2.new(0.406, 0, 0.499, 0)
  133. startbutton.Size = UDim2.new(0, 200, 0, 50)
  134. startbutton.BackgroundColor3 = Color3.new(0.38, 0.792, 0.125)
  135. startbutton.BorderSizePixel = 7
  136. startbutton.Text = "Start"
  137. startbutton.TextSize = 10
  138. startbutton.MouseButton1Down:Connect(function()
  139. canvas.BackgroundTransparency = 1
  140. TitleScreen(true)
  141. startbutton:Destroy()
  142. end)
  143.  
  144. local priorityassets = {}
  145.  
  146. -- insertion of client assets into loading priority
  147. local function Scan(location,mytable)
  148. for _, i in pairs(location:GetChildren()) do
  149. if i:IsA'ImageLabel' then
  150. table.insert(mytable, i.Image)
  151. elseif i:IsA'ImageButton' then
  152. table.insert(mytable, i.Image)
  153. elseif i:IsA'Sound' then
  154. table.insert(mytable, i.SoundId)
  155. end
  156. Scan(i,mytable)
  157. end
  158. end
  159.  
  160. -- index priority assets
  161. Scan(script.Parent.Loading, priorityassets)
  162. Scan(script.Parent.Title, priorityassets)
  163. -- update with more stuff later
  164.  
  165. -- load priority assets
  166. for i = 1,#priorityassets do
  167. ContentProvider:PreloadAsync({priorityassets[i]})
  168. prioritylabel.Text = "Menu assets have been loaded:"..math.floor(100*i/#priorityassets).."%..."
  169. end
  170. prioritylabel.Text = "Menu assets finished loading!"
  171.  
  172. --load normal assets
  173. while (ContentProvider.RequestQueueSize > 0) do
  174. normallabel.Text = math.floor(ContentProvider.RequestQueueSize).." assets left..."
  175. wait(1/60)
  176. end
  177. normallabel.Text = "All assets finished loading!"
  178. local okbutton = Instance.new("TextButton", canvas)
  179. okbutton.Position = UDim2.new(0.77, 0, 1.12, 0)
  180. okbutton.Size = UDim2.new(0, 20, 0, 20)
  181. okbutton.Text = "OK!"
  182. okbutton.BorderSizePixel = 3
  183. okbutton.BackgroundColor3 = Color3.new(0.851, 0.506, 0.161)
  184. okbutton.MouseButton1Down:Connect(function()
  185. okbutton:TweenPosition(UDim2.new(0.77, 0, 1.42, 0), "In", "Back", 1, true, function() okbutton:Destroy() end)
  186. normallabel:TweenPosition(UDim2.new(0, 0, 0.5, 0), "In", "Back", 1, true, function() normallabel:Destroy() end)
  187. end)
  188. okbutton:TweenPosition(UDim2.new(0.77, 0, 0.92, 0), "Out", "Back", 1, false)
  189. prioritylabel:TweenPosition(UDim2.new(1, 0, 0, 0), "In", "Quad", 2, true, function() prioritylabel:Destroy() end)
  190.  
  191. _G.Loaded = true
  192. end
  193.  
  194.  
  195.  
  196.  
  197.  
  198. if _G.Loaded == true then
  199. TitleScreen(false)
  200. else
  201. LoadingScreen()
  202. end
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. --start of list start of list start of list start of list start of list
  218.  
  219. --ANY USE
  220. local updatedroot
  221. local Camera = workspace.CurrentCamera
  222. --LOADVIEW USE ONLY
  223. local lastd = 0
  224. local debounce = true
  225. local currentroot = workspace.SpectateRoots["Spawn"]
  226. local crootcf = currentroot.CFrame
  227. local descamcf
  228.  
  229. --end of list end of list end of list end of list end of list
  230.  
  231.  
  232.  
  233. local function LoadView(newroot) -- Creates circle spinny perspective when spawning
  234. if debounce then
  235. debounce = false
  236. if newroot ~= currentroot then
  237. currentroot = newroot
  238. crootcf = currentroot.CFrame
  239. descamcf = CFrame.lookAt(((crootcf * CFrame.Angles(0, math.rad(lastd), 0) * CFrame.new(0, 25, 25))).Position, currentroot.Position)
  240.  
  241.  
  242. --transition lol
  243.  
  244.  
  245. end
  246. debounce = true
  247. end
  248.  
  249. while currentroot == updatedroot do
  250. if lastd > 359.5 then lastd = 0 end
  251. for d = lastd,360,0.5 do
  252. lastd = d
  253. Camera.CameraType = "Scriptable"
  254. Camera.CFrame = CFrame.lookAt(((crootcf * CFrame.Angles(0, math.rad(d), 0) * CFrame.new(0, 25, 25))).Position, currentroot.Position)
  255. wait(1/60)
  256. end
  257. end
  258. end
  259.  
  260. wait(10) -- REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE REMOVE
  261. updatedroot = workspace.SpectateRoots["Spawn"]
  262. LoadView(updatedroot)
  263. wait(10)
  264. print("now")
  265. updatedroot = workspace.SpectateRoots["Mountain"]
  266. LoadView(updatedroot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement