Advertisement
Guest User

flood escape main script

a guest
Dec 23rd, 2019
8,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 68.93 KB | None | 0 0
  1. local rs = game:GetService("RunService")
  2. local uis = game:GetService("UserInputService")
  3. local cas = game:GetService("ContextActionService")
  4. local cs = game:GetService("ContentProvider")
  5. local debris = game:GetService("Debris")
  6. local lighting = game:GetService("Lighting")
  7. local rem = game.ReplicatedStorage:WaitForChild("Remote")
  8. local remScripts = game.ReplicatedStorage.Scripts
  9. local masterControl = require(script.Parent:WaitForChild("PlayerModule").ControlModule)
  10. game.StarterGui:SetCoreGuiEnabled(1, false)
  11. game.StarterGui:SetCoreGuiEnabled(2, false)
  12. TimesSurvived = 0
  13. local passKey
  14. repeat
  15. passKey = rem.ReqPasskey:InvokeServer()
  16. if not passKey then
  17. wait(2)
  18. end
  19. until passKey
  20. rem.ReqPasskey:Destroy()
  21. local player = game.Players.LocalPlayer
  22. local cam = game.Workspace.CurrentCamera
  23. local camWater, char, hum, humRtPt, humHead, depthVel, oldPos
  24. --print("Fetching playerData/itemData")
  25. local playerData, itemData
  26. repeat
  27. playerData, itemData = rem.ReqItemData:InvokeServer(-passKey, player, true)
  28. if not playerData then
  29. wait(2)
  30. end
  31. until playerData and itemData
  32. --print("Should be good:", tostring(playerData), tostring(itemData))
  33. local gui = player.PlayerGui:WaitForChild("GameGui")
  34. local minimalGui = player.PlayerGui:WaitForChild("MinimalGui")
  35. local hud = gui:WaitForChild("HUD")
  36. local summary = gui:WaitForChild("Summary")
  37. local notif = gui:WaitForChild("Notification")
  38. local shop = gui:WaitForChild("Shop")
  39. local shopState = "main"
  40. local shopSort = "all"
  41. local shopList = shop.Items.Holder
  42. local currentShopItem
  43. local sortButtons = {
  44. {
  45. shop:WaitForChild("ViewAll"),
  46. "all"
  47. },
  48. {
  49. shop:WaitForChild("ViewOwned"),
  50. "owned"
  51. }
  52. }
  53. local howToPage = 1
  54. local maxHowToPage = 3
  55. local alertList = {}
  56. local stayAlertList = {}
  57. local menuEnabled = true
  58. local guiAirState = "air"
  59. local shopStandTouch = tick()
  60. local showRebirth = false
  61. local notifyFunc = function()
  62. --print("No function set for notifyFunc")
  63. end
  64. local notifyQueue = {}
  65. local spectate = gui:WaitForChild("Spectate")
  66. local options = gui:WaitForChild("Options")
  67. local loading = gui:WaitForChild("Loading")
  68. local alerts = hud:WaitForChild("Alerts")
  69. local guiMenus = {
  70. {
  71. shop,
  72. hud:WaitForChild("Shop")
  73. },
  74. {
  75. spectate,
  76. hud:WaitForChild("Spectate"),
  77. spectate:WaitForChild("Close")
  78. },
  79. {
  80. summary,
  81. hud:WaitForChild("Summary"),
  82. summary:WaitForChild("Close")
  83. },
  84. {
  85. options,
  86. hud:WaitForChild("Options"),
  87. options:WaitForChild("Close")
  88. },
  89. }
  90. local sumDif = {
  91. "Easy",
  92. "Normal",
  93. "Hard",
  94. "Insane",
  95. "Crazy",
  96. }
  97. local difColors = {
  98. Color3.fromRGB(85, 255, 127),
  99. Color3.fromRGB(255, 255, 127),
  100. Color3.fromRGB(255, 85, 127),
  101. Color3.fromRGB(170, 85, 255),
  102. Color3.fromRGB(255, 165, 0),
  103. }
  104. local menuOpen, screenFadeState, iFade
  105. local lobbyDetail = workspace:WaitForChild("Lobby"):WaitForChild("Detail")
  106. local gameState, multiMap
  107. local LobbyWaters = workspace:WaitForChild("Lobby"):WaitForChild("Waters")
  108. local swimmables = workspace:WaitForChild("Lobby"):WaitForChild("Waters"):GetDescendants()
  109. local multiSurvive, multiLoaded, exitChecking, neededAssets
  110. local charState = 5
  111. local maxTankAir = 300
  112. local tankAir = 0
  113. local maxBasicAir = 1
  114. local basicAir = maxBasicAir
  115. local tempAir = 10
  116. local airDrainRate = 8
  117. local airRegenRate = 16
  118. local lowestAir = basicAir
  119. local lastSurfaced = tick()
  120. local lastAcid = tick()
  121. local swimTipped = 3 < playerData.stats.level
  122. local lobbyBgm = game.ReplicatedStorage.LobbyMusic.Value
  123. local bgm = Instance.new("Sound")
  124. bgm.Looped = true
  125. bgm.Volume = 0
  126. bgm.Name = "BGM"
  127. bgm.Parent = player
  128. local riseVal = 0
  129. local wParticles = script.WaterParticles:Clone()
  130. local wParticlesP = Instance.new("Part")
  131. wParticlesP.Size = Vector3.new(30, 30, 30)
  132. wParticlesP.Anchored = true
  133. wParticlesP.CanCollide = false
  134. wParticlesP.Transparency = 1
  135. wParticlesP.Parent = game.Workspace
  136. local waitingCamFrame = {
  137. CFrame.new(-25.5151863, -126.479607, 42.9704247, -1, 1.07924629E-4, -3.81470047E-4, 7.27595848E-12, 0.962231636, 0.272232294, 3.96443123E-4, 0.272232294, -0.962231457),
  138. CFrame.new(-25.5, -130.549866, 63.149971, -1, 0, 0, 0, 1, 0, 0, 0, -1),
  139. CFrame.new(-20.9070778, -129.621719, 45.3437462, -0.879642725, -0.115875036, 0.461304396, 0, 0.969870448, 0.243621677, -0.475635171, 0.214300036, -0.853139341),
  140. CFrame.new(-19.5606194, -129.514816, -16.9193382, -0.889419019, -0.0880693123, 0.44852829, 0, 0.981263161, 0.192672729, -0.457092792, 0.171366796, -0.872754097)
  141. }
  142. local chosenCamFrame = 1
  143. local lastInputType, mapTimer
  144. local isVIP = rem.ReqVIPStatus:InvokeServer(-passKey)
  145. IsAdmin = true
  146. local debugAir
  147. local BGMmuted = false
  148. local AurasDisabled = false
  149. local KEYBINDS = {
  150. EMOTE = Enum.KeyCode.E,
  151. SWIMDIVE = Enum.KeyCode.LeftShift,
  152. SWIMJUMP = Enum.KeyCode.Space
  153. }
  154. local NOBINDS = {
  155. Enum.KeyCode.W,
  156. Enum.KeyCode.A,
  157. Enum.KeyCode.S,
  158. Enum.KeyCode.D,
  159. Enum.KeyCode.Escape,
  160. Enum.KeyCode.Unknown
  161. }
  162.  
  163. local touchJump
  164. function newStayAlert(msg, color, add)
  165. if add == true then
  166. local minAlert = Instance.new("TextLabel")
  167. minAlert.ZIndex = 3
  168. minAlert.Text = msg
  169. minAlert.TextColor3 = color or Color3.new(1, 1, 1)
  170. minAlert.TextScaled = true
  171. minAlert.Font = "Highway"
  172. minAlert.TextStrokeTransparency = 0
  173. minAlert.BackgroundTransparency = 1
  174. minAlert.Size = UDim2.new(1, 0, -0.25, 0)
  175. minAlert.Position = UDim2.new(0, 0, 1, 0)
  176. local alert = Instance.new("TextLabel")
  177. delay(0, function()
  178. alert.ZIndex = 3
  179. alert.Text = msg
  180. alert.TextColor3 = color or Color3.new(1, 1, 1)
  181. alert.TextScaled = true
  182. alert.Font = "Highway"
  183. alert.TextStrokeTransparency = 0
  184. alert.BackgroundTransparency = 1
  185. alert.Size = UDim2.new(1, 0, 1, 0)
  186. alert.Position = UDim2.new(0, 0, 0,1- alerts.AbsoluteSize.Y * 0.5)
  187. alert.Parent = alerts
  188. table.insert(stayAlertList, 1, alert)
  189. for i = 1, -0.1, -0.1 do
  190. alert.TextTransparency = i
  191. alert.TextStrokeTransparency = i + 0.1
  192. wait()
  193. end
  194. end)
  195. return alert, minAlert
  196. else
  197. handleAlert(1, stayAlertList[1], true)
  198. end
  199. end
  200. function closeNotif()
  201. notif.Visible = false
  202. function notifyFunc()
  203. --print("Blank")
  204. end
  205. if #notifyQueue > 0 then
  206. local qNotif = notifyQueue[1]
  207. newNotification(qNotif.info, qNotif.title, qNotif.func)
  208. table.remove(notifyQueue, 1)
  209. end
  210. newSound(1524549907)
  211. end
  212. function newNotification(newInfo, newTitle, actionFunc)
  213. if notif.Visible == true then
  214. table.insert(notifyQueue, {
  215. info = newInfo,
  216. title = newTitle,
  217. func = actionFunc
  218. })
  219. else
  220. newSound(1523860403)
  221. local choice = actionFunc and true or false
  222. notif.Visible = true
  223. notif.Window.Content.Info.Text = newInfo
  224. notif.Window.Title.Text = newTitle or "Notification"
  225. notif.Window.Choices.Visible = choice
  226. notif.Window.Confirm.Visible = not choice
  227. notifyFunc = actionFunc or function()
  228. --print("Blank")
  229. end
  230. if choice then
  231. game:GetService("GuiService").SelectedObject = notif.Window.Choices.No
  232. else
  233. game:GetService("GuiService").SelectedObject = notif.Window.Confirm
  234. end
  235. notif.Window.Position = UDim2.new(0.5, 0, 0.7, 0)
  236. notif.Window:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Elastic", 0.55, true)
  237. end
  238. end
  239.  
  240. function replaceKeybind(bindToReplace, newKey, option, override)
  241. local canReplace = true
  242. if not override then
  243. for i, c in pairs(KEYBINDS) do
  244. if KEYBINDS[i] == newKey then
  245. canReplace = false
  246. end
  247. end
  248. for i, c in pairs(NOBINDS) do
  249. if c == newKey then
  250. canReplace = false
  251. end
  252. end
  253. end
  254. KEYBINDS[bindToReplace] = canReplace and newKey or KEYBINDS[bindToReplace]
  255. if option then
  256. option.Notch.Info.Text = string.sub(tostring(KEYBINDS[bindToReplace]), 14)
  257. do
  258. local feedbackColor = canReplace and Color3.fromRGB(39, 174, 96) or Color3.fromRGB(192, 57, 43)
  259. option.Notch.BGf.BackgroundColor3 = feedbackColor
  260. spawn(function()
  261. wait(0.15)
  262. if option.Notch.BGf.BackgroundColor3 == feedbackColor then
  263. option.Notch.BGf.BackgroundColor3 = Color3.fromRGB(41, 128, 185)
  264. end
  265. end)
  266. end
  267. end
  268. return canReplace
  269. end
  270. function inPart(pos, item)
  271. return require(remScripts.FE2Library).inPart(pos, item, swimmables)
  272. end
  273. function screenFade(dir, t, state, load, resume)
  274. delay(0, function()
  275. screenFadeState = dir
  276. local begin = dir == "In" and 1 or 0
  277. local finish = math.abs(begin - 1)
  278. local duration = (finish - begin) * (t / 30)
  279. game.Lighting.Fade_Blur.Enabled = true
  280. game.Lighting.Fade_ColorCorrection.Enabled = true
  281. loading.Visible = load or loading.Visible
  282. if game.Lighting.Fade_ColorCorrection.Brightness ~= -finish then
  283. for i = resume and iFade or begin, finish, duration do
  284. if screenFadeState == dir then
  285. iFade = i
  286. game.Lighting.Fade_Blur.Size = i * 100
  287. game.Lighting.Fade_ColorCorrection.Brightness = -(i * i)
  288. if loading.Visible then
  289. loading.Info.TextTransparency = 1 - i
  290. loading.Info.TextStrokeTransparency = 1 - (i - 0.1)
  291. loading.Swirl.ImageTransparency = 1 - i
  292. end
  293. wait()
  294. end
  295. end
  296. end
  297. loading.Visible = state and load
  298. game.Lighting.Fade_Blur.Enabled = state
  299. game.Lighting.Fade_ColorCorrection.Enabled = state
  300. end)
  301. end
  302. function updBgm(id)
  303. delay(0, function()
  304. local BGMchanging = true
  305. local oldId = bgm.SoundId
  306. local newBGM
  307. if id ~= 0 then
  308. newBGM = Instance.new("Sound")
  309. newBGM.SoundId = "rbxassetid://" .. id
  310. newBGM.Looped = true
  311. newBGM.Volume = 0
  312. newBGM.Name = "BGM"
  313. newBGM.Parent = player
  314. end
  315. while 0 < bgm.Volume and wait() do
  316. bgm.Volume = bgm.Volume - 0.03333333333333333
  317. end
  318. if bgm.SoundId == oldId then
  319. bgm:Stop()
  320. end
  321. if id ~= 0 then
  322. bgm:Destroy()
  323. newBGM.Parent = script
  324. bgm = newBGM
  325. while not bgm.IsLoaded do
  326. wait()
  327. end
  328. bgm:Play()
  329. bgm.Volume = 0
  330. bgm.SoundGroup = camWater and game.SoundService.Underwater or nil
  331. while bgm.SoundId == newBGM.SoundId and bgm.Volume < 1 and not BGMmuted and wait() do
  332. bgm.Volume = bgm.Volume + 0.03333333333333333
  333. end
  334. end
  335. end)
  336. end
  337. function updLighting(newLighting)
  338. local propsToFind = {
  339. "Ambient",
  340. "Brightness",
  341. "ColorShift_Bottom",
  342. "ColorShift_Top",
  343. "OutdoorAmbient",
  344. "TimeOfDay",
  345. "FogColor",
  346. "FogEnd",
  347. "FogStart",
  348. }
  349. local new = {
  350. Ambient = Color3.fromRGB(127, 127, 127),
  351. Brightness = 1,
  352. OutdoorAmbient = Color3.fromRGB(127, 127, 127),
  353. ColorShift_Bottom = Color3.new(),
  354. ColorShift_Top = Color3.new(),
  355. TimeOfDay = "14:00:00",
  356. FogColor = Color3.fromRGB(191, 191, 191),
  357. FogEnd = 100000,
  358. FogStart = 0,
  359. }
  360. if newLighting ~= nil and newLighting:IsA("Folder") then
  361. for _, c in pairs(newLighting:GetChildren()) do
  362. for _, a in pairs(propsToFind) do
  363. if c.Name == a then
  364. new[c.Name] = c.Value
  365. break
  366. end
  367. end
  368. end
  369. end
  370. for _, a in pairs(propsToFind) do
  371. lighting[a] = new[a]
  372. end
  373. end
  374. function countAssets(item)
  375. local newAssets = item:GetChildren()
  376. local count = #newAssets
  377. for _, c in pairs(newAssets) do
  378. count = count + countAssets(c)
  379. end
  380. return count
  381. end
  382. function updMultiMap(item)
  383. --print(item.Name)
  384. if item.Name == "NewMap" then
  385. multiMap = item
  386. repeat
  387. wait()
  388. until item.Name == "Map"
  389. end
  390. if item.Name == "Map" then
  391. multiMap = item
  392. swimmables = LobbyWaters:GetDescendants()
  393. findWater(multiMap)
  394. if gameState == "ingame" or gameState == "loading" then
  395. if gameState == "ingame" or gameState == "loading" then
  396. initiateMultiMap(multiMap)
  397. end
  398. multiMap:WaitForChild("Settings")
  399. updLighting(multiMap.Settings.Lighting)
  400. end
  401. end
  402. end
  403. game.Workspace.Multiplayer.ChildAdded:connect(updMultiMap)
  404. function curWaitCam()
  405. local waitFrame = waitingCamFrame[chosenCamFrame] * CFrame.Angles(math.sin(tick() * 1.666) * 0.01, math.sin(tick()) * 0.04, math.sin(tick() * 0.1) * 0.01) * CFrame.new(math.sin(tick() * 1), math.sin(tick() * 1.666) * 0.02, 0)
  406. return waitFrame
  407. end
  408. function updGameState(gState, assets)
  409. local oldGameState = gameState
  410. gameState = gState
  411. workspace.Lobby.PlayHere.SurfaceGui.Enabled = gameState ~= "waiting"
  412. workspace.Lobby.GameInfo.SurfaceGui.AlwaysOnTop = gameState == "waiting"
  413. hud.MenuToggle.Stats.Visible = gameState == nil or gameState == "waiting" or gameState == "loading" and oldGameState == "waiting"
  414. hud.MenuToggle.Air.Visible = gameState == "ingame" or gameState == "loading" and oldGameState == "ingame"
  415. if gameState == "waiting" then
  416. cam.CameraType = "Scriptable"
  417. chosenCamFrame = math.random(3, #waitingCamFrame)
  418. spawn(function()
  419. local oldCamFrame = cam.CFrame
  420. local setTime = tick()
  421. repeat
  422. if tick() <= setTime + 0.5 then
  423. cam.CFrame = oldCamFrame:lerp(curWaitCam(), math.sin((tick() - setTime) * 2 * (math.pi / 2)))
  424. elseif cam.CameraSubject == hum then
  425. cam.CFrame = curWaitCam()
  426. end
  427. rs.RenderStepped:wait()
  428. until gameState ~= "loading" and gameState ~= "waiting"
  429. end)
  430. elseif gameState ~= "loading" then
  431. cam.CameraType = "Custom"
  432. end
  433. if gameState == "loading" and assets then
  434. screenFade("Out", 2, true, true)
  435. loading.Info.Text = "Loading Map..."
  436. loading.Swirl.Rotation = 0
  437. repeat
  438. wait()
  439. until multiMap
  440. while wait(0.1) do
  441. local count = countAssets(multiMap)
  442. loading.Info.Text = "Loading Map (" .. tostring(math.floor(count / assets * 100)) .. "%)"
  443. --print(count, assets)
  444. if assets <= count then
  445. break
  446. end
  447. end
  448. if isLowPerformance then
  449. local mapObjs = multiMap:GetDescendants()
  450. for _, c in next, mapObjs, nil do
  451. if c.Name == "_Detail" then
  452. c:Destroy()
  453. elseif c:IsA("BasePart") then
  454. c.Material = Enum.Material.SmoothPlastic
  455. elseif c:IsA("ParticleEmitter") or c:IsA("Smoke") or c:IsA("Fire") or c:IsA("Sparkles") then
  456. c.Enabled = false
  457. end
  458. end
  459. end
  460. rem.LoadedMap:FireServer(-passKey)
  461. loading.Info.Text = "Waiting for Server"
  462. end
  463. if gameState == "ingame" then
  464. lobbyDetail.Parent = nil
  465. if hum and cam.CameraSubject ~= hum then
  466. cam.CameraSubject = hum
  467. end
  468. tankAir = 0
  469. tempAir = 0
  470. basicAir = maxBasicAir
  471. lowestAir = basicAir
  472. hud.MenuToggle.Air.BasicBar.Position = UDim2.new(0.025, 0, 0.95, 0)
  473. hud.MenuToggle.Air.AirText.TextColor3 = Color3.new(1, 1, 1)
  474. if oldGameState == "loading" then
  475. loading.Info.Text = "Ready!"
  476. screenFade("In", 2, false, true, true)
  477. end
  478. multiSurvive = nil
  479. end
  480. if gameState == nil then
  481. if oldGameState == "ingame" then
  482. toggleMarkerVisibility(false)
  483. end
  484. lobbyDetail.Parent = workspace.Lobby
  485. end
  486. end
  487. function switchAir(airType)
  488. if airType == "tank" then
  489. hud.MenuToggle.Air.BasicBar.Position = UDim2.new(0.025, 0, 0.95, 0)
  490. hud.MenuToggle.Air.BasicBar:TweenSize(UDim2.new(0.95, 0, -0.1, 0), "Out", "Sine", 0.3, true)
  491. hud.MenuToggle.Air.TankBar:TweenSize(UDim2.new(0.9, 0, 0.25, 1), "Out", "Sine", 0.3, true)
  492. hud.MenuToggle.Air.AirText.TextColor3 = Color3.new(1, 1, 1)
  493. guiAirState = "tank"
  494. else
  495. hud.MenuToggle.Air.TankBar:TweenSize(UDim2.new(0.9, 0, 0.1, 1), "Out", "Sine", 0.3, true)
  496. hud.MenuToggle.Air.BasicBar:TweenSize(UDim2.new(0.95, 0, -0.25, 0), "Out", "Sine", 0.3, true)
  497. guiAirState = "air"
  498. end
  499. script.Air:Play()
  500. hud.MenuToggle.Air.Position = UDim2.new()
  501. end
  502. function takeAir(amount)
  503. local amt = amount
  504. if tankAir > 0 then
  505. tankAir = tankAir - amt
  506. if tankAir < 0 then
  507. amt = math.abs(tankAir)
  508. else
  509. amt = 0
  510. end
  511. end
  512. basicAir = basicAir - amt
  513. if basicAir < 0 then
  514. basicAir = 0
  515. end
  516. end
  517. function CharAdded(newChar)
  518. TimesSurvived = 0
  519. char = newChar
  520. hum = char:WaitForChild("Humanoid")
  521. humRtPt = char:WaitForChild("HumanoidRootPart")
  522. humHead = char:WaitForChild("Head")
  523. basicAir = maxBasicAir
  524. tankAir = 0
  525. switchAir()
  526. depthVel = Instance.new("BodyVelocity", humRtPt)
  527. depthVel.Name = "SwimVel"
  528. depthVel.MaxForce = Vector3.new(0, 0, 0)
  529. depthVel.P = 8000
  530. depthVel.Velocity = Vector3.new(1, 0, 1)
  531. humRtPt.Touched:connect(function(hit)
  532. hum.WalkSpeed = 21
  533. if hit.Parent and hit.Parent.Name == "AirTank" and hit.Parent:FindFirstChild("Hitbox") then
  534. local par = hit.Parent
  535. par.Hitbox:Destroy()
  536. if tankAir <= 0 then
  537. switchAir("tank")
  538. end
  539. tankAir = maxTankAir
  540. local oldScale = par.Outline.Mesh.Scale
  541. local oldTransparency = par.Outline.Transparency
  542. for i = 0, 1, 0.03333333333333333 do
  543. par.Outline.Mesh.Scale = oldScale + Vector3.new(i, i, i)
  544. par.Outline.Transparency = oldTransparency + i * 0.6
  545. rs.RenderStepped:wait()
  546. end
  547. par:Destroy()
  548. end
  549. end)
  550. hum.Touched:connect(function(pt)
  551. if pt.Parent ~= nil and hum.Health > 0 and pt.Parent.Name == "ShopTriggers" and shopState ~= pt.Name and tick() - shopStandTouch > 1.5 then
  552. changeMenu(1)
  553. updShop(pt.Name)
  554. end
  555. if pt.Name == "BGMTrigger" and bgm.SoundId ~= "rbxassetid://" .. pt.BGM.Value then
  556. updBgm(pt.BGM.Value)
  557. end
  558. end)
  559. hum.Died:connect(function()
  560. local humCheck = hum
  561. cas:UnbindAction("swimDive")
  562. cas:UnbindAction("swimJump")
  563. charState = 0
  564. updGameState(nil)
  565. loading.Visible = false
  566. local PhysList = {}
  567. for _, c in pairs(newChar:GetChildren()) do
  568. if c:IsA("BasePart") then
  569. local BodyPos = Instance.new("BodyPosition", c)
  570. BodyPos.P = 10000
  571. BodyPos.MaxForce = Vector3.new()
  572. table.insert(PhysList, BodyPos)
  573. end
  574. end
  575. spawn(function()
  576. local maxTime = tick() + 5
  577. while maxTime > tick() and rs.RenderStepped:wait() do
  578. for _, bodypos in pairs(PhysList) do
  579. if bodypos.Parent then
  580. local force = inPart(bodypos.Parent.Position, swimmables) and 1100 or 0
  581. bodypos.Position = bodypos.Parent.Position
  582. bodypos.MaxForce = Vector3.new(force * 0.05, force, force * 0.05)
  583. else
  584. bodypos:Destroy()
  585. end
  586. end
  587. end
  588. end)
  589. wait(1.9)
  590. if hum == humCheck then
  591. updBgm(0)
  592. screenFade("Out", 1, true, false)
  593. end
  594. end)
  595. hum.Seated:connect(function(val)
  596. if val == true then
  597. hum.Health = 0
  598. newAlert(">:(", Color3.new(1, 0, 0))
  599. end
  600. end)
  601. newChar.ChildAdded:connect(function(item)
  602. if item:IsA("Accessory") then
  603. item:WaitForChild("Handle")
  604. item.Handle.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
  605. end
  606. if item.Name == "LocalEventScript" and item:IsA("LocalScript") then
  607. item.Disabled = false
  608. end
  609. end)
  610. updLighting()
  611. updBgm(lobbyBgm)
  612. screenFade("In", 1, false)
  613. spawn(function()
  614. local setTime = tick()
  615. repeat
  616. hum.CameraOffset = Vector3.new(0, -4 + math.sin((tick() - setTime) / 1.5 * (math.pi / 2)) * 4, 0)
  617. game:GetService("RunService").Heartbeat:wait()
  618. until tick() - setTime > 1.5
  619. end)
  620. if uis.TouchEnabled then
  621. repeat
  622. wait(1)
  623. until player.PlayerGui:findFirstChild("JumpButton", true)
  624. touchJump = player.PlayerGui:findFirstChild("JumpButton", true)
  625. if touchJump then
  626. touchJump.InputBegan:connect(function(ioObj)
  627. swimJump("Touch", ioObj.UserInputState)
  628. end)
  629. touchJump.InputEnded:connect(function(ioObj)
  630. swimJump("Touch", ioObj.UserInputState)
  631. end)
  632. end
  633. end
  634. end
  635. function findWater(item)
  636. for i, c in pairs(item:GetChildren()) do
  637. if string.find(c.Name, "_Water") then
  638. table.insert(swimmables, c)
  639. if not c:findFirstChild("BlockMesh") then
  640. local mesh = Instance.new("BlockMesh")
  641. mesh.Scale = Vector3.new(1, 0, 1)
  642. mesh.Offset = Vector3.new(0, c.Size.Y * 0.5, 0)
  643. mesh.Parent = c
  644. end
  645. else
  646. findWater(c)
  647. end
  648. end
  649. end
  650. function toggleMarkerVisibility(state)
  651. if multiMap then
  652. for _, c in next, multiMap:GetDescendants() do
  653. if c:IsA("BillboardGui") then
  654. c.Enabled = state
  655. end
  656. end
  657. end
  658. end
  659. function initiateMultiMap(item)
  660. screenFade("Out", 2, true, true)
  661. local newBgm = item.Settings.BGM
  662. if newBgm then
  663. updBgm(newBgm.Value)
  664. end
  665. toggleMarkerVisibility(true)
  666. riseList = {}
  667. riseVal = 30
  668. if multiMap:findFirstChild("Intro") then
  669. table.insert(riseList, multiMap.Intro)
  670. end
  671. for _, i in pairs(riseList) do
  672. i:TranslateBy(Vector3.new(0, -riseVal, 0))
  673. end
  674. end
  675. function doEmote(action, uiState)
  676. if uiState == Enum.UserInputState.Begin then
  677. local localKey = KEYBINDS.EMOTE
  678. if char and char:FindFirstChild("Animate") then
  679. char.Animate.EmoteFire:Fire()
  680. end
  681. end
  682. end
  683. local tweenInfoCooldown = TweenInfo.new(
  684. 5, -- Time
  685. Enum.EasingStyle.Linear, -- EasingStyle
  686. Enum.EasingDirection.Out, -- EasingDirection
  687. 0, -- RepeatCount (when less than zero the tween will loop indefinitely)
  688. false, -- Reverses (tween will reverse once reaching it's goal)
  689. 0 -- DelayTime
  690. )
  691. function swimJump(action, uiState)
  692. if depthVel and hum and charState == 1 then
  693. if uiState == Enum.UserInputState.Begin then
  694. depthVel.Velocity = Vector3.new(0, hum.WalkSpeed, 0)
  695. elseif uiState == Enum.UserInputState.End and 0 < depthVel.Velocity.Y then
  696. depthVel.Velocity = Vector3.new(0, 0, 0)
  697. end
  698. end
  699. end
  700. function swimDive(action, uiState)
  701. if depthVel and hum and charState == 1 then
  702. if uiState == Enum.UserInputState.Begin then
  703. depthVel.Velocity = Vector3.new(0, -hum.WalkSpeed, 0)
  704. elseif uiState == Enum.UserInputState.End and 0 > depthVel.Velocity.Y then
  705. depthVel.Velocity = Vector3.new(0, 0, 0)
  706. end
  707. end
  708. end
  709. function bindSwimActions()
  710. if charState == 1 then
  711. cas:BindAction("swimJump", swimJump, true, KEYBINDS.SWIMJUMP)
  712. cas:BindAction("swimDive", swimDive, true, KEYBINDS.SWIMDIVE)
  713. cas:SetTitle("swimDive", "Dive")
  714. cas:SetTitle("swimJump", "Swim")
  715. if touchJump then
  716. local dive = cas:GetButton("swimDive")
  717. dive.Size = UDim2.new(0, touchJump.AbsoluteSize.X, 0, touchJump.AbsoluteSize.Y)
  718. dive.Position = UDim2.new(0, touchJump.AbsolutePosition.X - dive.Parent.AbsolutePosition.X, 0, touchJump.AbsolutePosition.Y - dive.Parent.AbsolutePosition.Y - dive.AbsoluteSize.Y * 0.75)
  719. local title = dive:findFirstChild("ActionTitle")
  720. if title then
  721. title.Size = UDim2.new(0.75, 0, 0.75, 0)
  722. title.Position = UDim2.new(0.125, 0, 0.125, 0)
  723. title.TextXAlignment = "Center"
  724. title.TextYAlignment = "Center"
  725. title.TextScaled = true
  726. end
  727. end
  728. if touchJump then
  729. local jump = cas:GetButton("swimJump")
  730. jump.Size = UDim2.new(0, touchJump.AbsoluteSize.X, 0, touchJump.AbsoluteSize.Y)
  731. jump.Position = UDim2.new(0, touchJump.AbsolutePosition.X - jump.Parent.AbsolutePosition.X, 0, touchJump.AbsolutePosition.Y - jump.Parent.AbsolutePosition.Y - jump.AbsoluteSize.Y * 2.25)
  732. local title = jump:findFirstChild("ActionTitle")
  733. if title then
  734. title.Size = UDim2.new(0.75, 0, 0.75, 0)
  735. title.Position = UDim2.new(0.125, 0, 0.125, 0)
  736. title.TextXAlignment = "Center"
  737. title.TextYAlignment = "Center"
  738. title.TextScaled = true
  739. end
  740. end
  741. end
  742. end
  743. spawn(function()
  744. local step = 0
  745. while true do
  746. local newCam = inPart(cam.CFrame.p, swimmables)
  747. local newR, newG, newB
  748. if newCam then
  749. newR, newG, newB = newCam.BrickColor.r + (1 - newCam.BrickColor.r) * 0.33, newCam.BrickColor.g + (1 - newCam.BrickColor.g) * 0.33, newCam.BrickColor.b + (1 - newCam.BrickColor.b) * 0.33
  750. end
  751. if newCam ~= camWater then
  752. camWater = newCam
  753. for _, c in pairs(lighting:GetChildren()) do
  754. if c.Name:find("Water_") then
  755. c.Enabled = newCam
  756. end
  757. end
  758. lighting.Water_ColorCorrection.TintColor = newCam and Color3.new(newR, newG, newB) or lighting.Water_ColorCorrection.TintColor
  759. bgm.SoundGroup = newCam and game.SoundService.Underwater
  760. script.Splash_water.SoundGroup = newCam and game.SoundService.Underwater
  761. script.Splash_lava.SoundGroup = newCam and game.SoundService.Underwater
  762. script.Splash_acid.SoundGroup = newCam and game.SoundService.Underwater
  763. wParticles.Parent = wParticlesP
  764. end
  765. if newCam and lighting.Water_ColorCorrection.Enabled and lighting.Water_ColorCorrection.TintColor ~= Color3.new(newR, newG, newB) then
  766. lighting.Water_ColorCorrection.TintColor = lighting.Water_ColorCorrection.TintColor:lerp(Color3.new(newR, newG, newB), 0.05)
  767. end
  768. if camWater then
  769. hum.CameraOffset = Vector3.new(math.sin(tick() * 3) * 0.2, math.sin(tick() * 3.21) * 0.2, math.sin(tick() * 3.73) * 0.2)
  770. elseif camWater and not newCam then
  771. hum.CameraOffset = Vector3.new()
  772. end
  773. if newCam and cam.CameraSubject:IsA("Humanoid") and cam.CameraSubject.Torso ~= nil then
  774. local yLimit = 0
  775. wParticlesP.CFrame = CFrame.new(cam.CameraSubject.Torso.Position.X, cam.CameraSubject.Torso.Position.Y, cam.CameraSubject.Torso.Position.Z)
  776. end
  777. if riseVal ~= 0 then
  778. local dist = riseVal * (step * 2) + 0.015
  779. if riseVal < 0.05 then
  780. dist = riseVal
  781. end
  782. riseVal = riseVal - dist
  783. for _, i in pairs(riseList) do
  784. i:TranslateBy(Vector3.new(0, dist, 0))
  785. end
  786. end
  787. if humRtPt and humHead and hum then
  788. if 0 < hum.Health then
  789. if gameState == nil then
  790. if inPart(humRtPt.Position, game.ReplicatedStorage.WaitingRegion) then
  791. updGameState("waiting")
  792. newAlert("You will join the next round")
  793. rem.AddedWaiting:FireServer(-passKey)
  794. end
  795. elseif gameState == "waiting" and inPart(humRtPt.Position, game.ReplicatedStorage.WaitingRegion) == nil then
  796. updGameState(nil)
  797. rem.RemoveWaiting:FireServer(-passKey)
  798. newStayAlert(nil,nil,false)
  799. end
  800. if gameState == nil then
  801. if inPart(humRtPt.Position, workspace.Lobby.OWait) then
  802. local function newFunc()
  803. --print("test")
  804. end
  805. newNotification("This will cost 25 coins", "test", newFunc, true)
  806. wait(2.5)
  807. end
  808. end
  809. local inWater = inPart(humHead.Position, swimmables)
  810. local waterState = "water"
  811. if inWater and inWater:FindFirstChild("State") then
  812. waterState = inWater.State.Value
  813. end
  814. local newState = inWater and 1 or 0
  815. if newState ~= charState then
  816. charState = newState
  817. if char:FindFirstChild("Animate") then
  818. char.Animate.ToggleSwim:Fire(charState)
  819. end
  820. script["Splash_" .. waterState]:Play()
  821. if charState == 0 then
  822. lastSurfaced = tick()
  823. cas:UnbindAction("swimDive")
  824. cas:UnbindAction("swimJump")
  825. depthVel.MaxForce = Vector3.new(0, 8000, 0)
  826. depthVel.Velocity = Vector3.new(0, 50, 0)
  827. char.Head.Bubbles.Enabled = false
  828. wait(0.08)
  829. if depthVel.Velocity.Y == 50 then
  830. depthVel.MaxForce = Vector3.new(0, 0, 0)
  831. end
  832. if depthVel.Velocity.Y == 50 then
  833. depthVel.Velocity = Vector3.new(0, 0, 0)
  834. end
  835. elseif charState == 1 then
  836. if waterState == "acid" then
  837. takeAir(tempAir)
  838. tempAir = 0
  839. end
  840. depthVel.MaxForce = Vector3.new(0, 8000, 0)
  841. local currentInput = uis:GetKeysPressed()
  842. for i = 1, #currentInput do
  843. if currentInput[i].KeyCode == KEYBINDS.SWIMJUMP then
  844. depthVel.Velocity = Vector3.new(0, hum.WalkSpeed, 0)
  845. elseif currentInput[i].KeyCode == KEYBINDS.SWIMDIVE then
  846. depthVel.Velocity = Vector3.new(0, -hum.WalkSpeed, 0)
  847. end
  848. end
  849. char.Head.Bubbles.Enabled = true
  850. if not swimTipped then
  851. newAlert(string.sub(tostring(KEYBINDS.SWIMJUMP), 14) .. " - Swim Up | " .. string.sub(tostring(KEYBINDS.SWIMDIVE), 14) .. " - Dive")
  852. swimTipped = true
  853. end
  854. bindSwimActions()
  855. end
  856. end
  857. if multiMap and not multiSurvive then
  858. do
  859. local exitRegion = multiMap:FindFirstChild("ExitRegion", true)
  860. if exitRegion and inPart(humRtPt.Position, exitRegion) then
  861. if (humRtPt.Position - oldPos).magnitude > 300 * step then
  862. hum.Health = 0
  863. newAlert("No lol", Color3.new(1, 0, 0))
  864. elseif not exitChecking then
  865. exitChecking = true
  866. do
  867. local a1, a2 = newAlert("Checking...", Color3.new(0, 1, 0))
  868. local elapsedMapTime = tick() - mapTimer
  869. spawn(function()
  870. if rem.Survived:InvokeServer(player, -passKey, lowestAir, exitRegion, exitRegion.Position) then
  871. multiSurvive = true
  872. TimesSurvived = TimesSurvived+1
  873. for _, eb in pairs(multiMap:GetChildren()) do
  874. if eb.Name == "ExitBlock" then
  875. eb.CanCollide = true
  876. end
  877. end
  878. local finalTime = {
  879. minutes = tostring(math.floor(elapsedMapTime / 60)),
  880. seconds = tostring(math.floor(elapsedMapTime) - math.floor(elapsedMapTime / 60) * 60),
  881. ms = tostring(math.floor((elapsedMapTime - math.floor(elapsedMapTime)) * 1000))
  882. }
  883. if tonumber(finalTime.seconds) < 10 then
  884. finalTime.seconds = "0" .. finalTime.seconds
  885. end
  886. local surviveText = "You Survived! (" .. finalTime.minutes .. ":" .. finalTime.seconds .. "." .. finalTime.ms .. ")"
  887. if a1 and a2 then
  888. a1.Text = surviveText
  889. a2.Text = surviveText
  890. end
  891. elseif a1 and a2 then
  892. a1.Text = "Incorrect Exit"
  893. a2.Text = "Incorrect Exit"
  894. end
  895. if basicAir == 0 then
  896. hum.Health = 0
  897. end
  898. wait(0.5)
  899. exitChecking = false
  900. end)
  901. end
  902. end
  903. end
  904. local eBlocks = {}
  905. for _, c in pairs(multiMap:GetChildren()) do
  906. if c.Name == "ExitBlock" then
  907. table.insert(eBlocks, c)
  908. end
  909. end
  910. for _, b in pairs(eBlocks) do
  911. if inPart(humRtPt.Position, b) and (humRtPt.Position - oldPos).magnitude > 300 * step then
  912. hum.Health = 0
  913. newAlert("No lol", Color3.new(1, 0, 0))
  914. break
  915. end
  916. end
  917. end
  918. end
  919. if charState == 0 or gameState ~= "ingame" then
  920. if lastSurfaced < tick() - 1 then
  921. if basicAir < maxBasicAir then
  922. basicAir = basicAir + airRegenRate * step
  923. else
  924. basicAir = maxBasicAir
  925. end
  926. end
  927. elseif charState == 1 then
  928. local airDrainRate = waterState == "acid" and 30 or airDrainRate
  929. takeAir(airDrainRate * step)
  930. lowestAir = basicAir < lowestAir and basicAir or lowestAir
  931. if waterState == "acid" then
  932. lastAcid = tick()
  933. end
  934. if (not (waterState ~= "lava" or debugAir) or basicAir <= 0) and not multiSurvive and not exitChecking then
  935. hum.Health = 0
  936. newAlert("You have Drowned!", Color3.new(1, 0, 0))
  937. end
  938. end
  939. if lastAcid < tick() - 1 and tempAir > 0 then
  940. tempAir = tempAir - 5 * step
  941. end
  942. local tremorScale = 1 - basicAir / maxBasicAir * 5
  943. if tankAir > 0 then
  944. hud.MenuToggle.Air.AirText.Text = "Air Tank: " .. math.floor(tankAir) .. "/" .. maxTankAir
  945. else
  946. if tremorScale >= -0.05 then
  947. hud.MenuToggle.Air.Position = UDim2.new(math.random(-35, 35) * 0.001 * tremorScale, 0, math.random(-35, 35) * 0.001 * tremorScale, 0)
  948. if waterState == "water" then
  949. hud.MenuToggle.Air.AirText.TextColor3 = Color3.new(1, 1 - tremorScale * 0.5, 1 - tremorScale * 0.5)
  950. end
  951. end
  952. if guiAirState == "tank" then
  953. switchAir()
  954. end
  955. hud.MenuToggle.Air.AirText.Text = "Air: " .. math.floor(basicAir) .. "/" .. maxBasicAir
  956. end
  957. if waterState == "acid" then
  958. if tempAir < 20 then
  959. tempAir = tempAir + 20 * step
  960. end
  961. hud.MenuToggle.Air.AirText.Text = "!CAUTION: ACID!"
  962. hud.MenuToggle.Air.AirText.TextColor3 = Color3.new(1, 0, 0)
  963. elseif hud.MenuToggle.Air.AirText.TextColor3 == Color3.new(1, 0, 0) then
  964. hud.MenuToggle.Air.AirText.TextColor3 = Color3.new(1, 1, 1)
  965. end
  966. hud.MenuToggle.Air.TankBar.Temp.Size = UDim2.new((tankAir - 0.1) / maxTankAir, 0, 1, 0)
  967. hud.MenuToggle.Air.TankBar.Percentage.Size = UDim2.new((tankAir - tempAir) / maxTankAir, 0, 1, 0)
  968. local basicTemp = 0
  969. if tankAir - tempAir <= 0 then
  970. if tankAir > 0 then
  971. basicTemp = math.abs(tankAir - tempAir)
  972. else
  973. basicTemp = tempAir
  974. end
  975. end
  976. hud.MenuToggle.Air.BasicBar.Percentage.Size = UDim2.new((basicAir - basicTemp) / maxBasicAir, 0, 1, 0)
  977. hud.MenuToggle.Air.BasicBar.Temp.Size = UDim2.new((basicAir - 0.1) / maxBasicAir, 0, 1, 0)
  978. if tempAir < 0 then
  979. tempAir = 0
  980. end
  981. game.Players.LocalPlayer.PlayerGui.MinimalGui.Air.TempAir.Text = tostring(math.floor(tempAir))
  982. game.Players.LocalPlayer.PlayerGui.MinimalGui.Air.TotalAir.Text = tostring("Air: " .. math.floor(basicAir) .. "/" .. maxBasicAir .. [[
  983.  
  984. Tank: ]] .. math.floor(tankAir) .. "/" .. maxTankAir)
  985. end
  986. oldPos = humRtPt.Position
  987. end
  988. if loading.Visible then
  989. loading.Swirl.Rotation = loading.Swirl.Rotation + 5
  990. end
  991. if showRebirth and hud.MenuToggle.Stats:FindFirstChild("Rebirth") then
  992. local sinA = (math.sin(tick() * 2) + 1) * 0.5
  993. hud.MenuToggle.Stats.Rebirth.BG.Glow.BackgroundColor3 = Color3.fromRGB(0 * sinA, 170 * sinA, 255 * sinA)
  994. hud.MenuToggle.Stats.Rebirth.BG.Glow.A.ImageColor3 = Color3.fromRGB(0 * sinA, 170 * sinA, 255 * sinA)
  995. hud.MenuToggle.Stats.Rebirth.BG.Glow.B.ImageColor3 = Color3.fromRGB(0 * sinA, 170 * sinA, 255 * sinA)
  996. end
  997. step = rs.Heartbeat:wait()
  998. end
  999. end)
  1000. rem.UpdateGameState.OnClientEvent:connect(updGameState)
  1001. rem.UpdLoadScreen.OnClientEvent:connect(function(val)
  1002. loading.Info.Text = val
  1003. --print("Set loading screen text to:", val)
  1004. end)
  1005. rem.StartClientMapTimer.OnClientEvent:connect(function()
  1006. mapTimer = tick()
  1007. end)
  1008. rem.TEST.AirToggle.OnClientEvent:connect(function()
  1009. debugAir = not debugAir
  1010. while debugAir do
  1011. rs.Heartbeat:wait()
  1012. basicAir = maxBasicAir
  1013. end
  1014. end)
  1015. function handleAlert(i, c, forced)
  1016. spawn(function()
  1017. if c.Parent == alerts or c.Parent == alerts then
  1018. local newPos = (i > 3 or forced) and -i or -(i - 1)
  1019. local ease = (i > 3 or forced) and "In" or "Out"
  1020. c:TweenPosition(UDim2.new(0, 0, newPos, 0), ease, "Sine", 0.3, true)
  1021. if i > 3 or forced then
  1022. table.remove(alertList, i)
  1023. for fade = 0, 1, 0.1 do
  1024. c.TextTransparency = fade
  1025. c.TextStrokeTransparency = fade + 0.1
  1026. wait()
  1027. end
  1028. c:Destroy()
  1029. end
  1030. end
  1031. end)
  1032. end
  1033. function newAlert(msg, color, timer, notifBar)
  1034. local minAlert = Instance.new("TextLabel")
  1035. minAlert.ZIndex = 3
  1036. minAlert.Text = msg
  1037. minAlert.TextColor3 = color or Color3.new(1, 1, 1)
  1038. minAlert.TextScaled = true
  1039. minAlert.Font = "Highway"
  1040. minAlert.TextStrokeTransparency = 0
  1041. minAlert.BackgroundTransparency = 1
  1042. minAlert.Size = UDim2.new(1, 0, -0.25, 0)
  1043. minAlert.Position = UDim2.new(0, 0, 1, 0)
  1044. for _, t in next, minimalGui.TextInfo:GetChildren() do
  1045. t.Position = UDim2.new(0, 0, t.Position.Y.Scale - 0.25, 0)
  1046. t.TextStrokeTransparency = 1
  1047. t.TextTransparency = t.TextTransparency + 0.2
  1048. end
  1049. minAlert.Parent = minimalGui.TextInfo
  1050. game:GetService("Debris"):AddItem(minAlert, timer or 5)
  1051. local alert = Instance.new("TextLabel")
  1052. delay(0, function()
  1053. alert.ZIndex = 3
  1054. alert.Text = msg
  1055. alert.TextColor3 = color or Color3.new(1, 1, 1)
  1056. alert.TextScaled = true
  1057. alert.Font = "Highway"
  1058. alert.TextStrokeTransparency = 0
  1059. alert.BackgroundTransparency = 1
  1060. alert.Size = UDim2.new(1, 0, 1, 0)
  1061. alert.Position = UDim2.new(0, 0, 0, alerts.AbsoluteSize.Y * 0.5)
  1062. alert.Parent = alerts
  1063. if notifBar == true then
  1064. local counter = Instance.new("Frame", alert)
  1065. counter.BorderSizePixel = 0
  1066. counter.BackgroundColor3 = color
  1067. counter.AnchorPoint = Vector2.new(0.5, 0.5)
  1068. counter.Position = UDim2.new(0.5)
  1069. counter.Size = UDim2.new(1, 0, 0.1, 0)
  1070. counter:TweenSize(UDim2.new(0, 0, 0.1, 0), "Out", "Linear", timer)
  1071. local bg = Instance.new("ImageLabel", counter)
  1072. bg.Image = "rbxassetid://156579757"
  1073. bg.Size = UDim2.new(1, 0, 1, 0)
  1074. bg.BackgroundTransparency = 1
  1075. bg.ImageTransparency = 0.5
  1076. end
  1077. table.insert(alertList, 1, alert)
  1078. for i, c in pairs(alertList) do
  1079. handleAlert(i, c)
  1080. end
  1081. for i = 1, -0.1, -0.13333333333333333 do
  1082. alert.TextTransparency = i
  1083. alert.TextStrokeTransparency = i + 0.1
  1084. wait()
  1085. end
  1086. wait(timer or 4)
  1087. if alert and 0 >= alert.TextTransparency then
  1088. local foundAlert = 1
  1089. for i = 1, #alertList do
  1090. if alertList[i] == alert then
  1091. foundAlert = i
  1092. break
  1093. end
  1094. end
  1095. handleAlert(foundAlert, alert, true)
  1096. end
  1097. end)
  1098. return alert, minAlert
  1099. end
  1100. function closeNotif()
  1101. notif.Visible = false
  1102. function notifyFunc()
  1103. --print("Blank")
  1104. end
  1105. if #notifyQueue > 0 then
  1106. local qNotif = notifyQueue[1]
  1107. newNotification(qNotif.info, qNotif.title, qNotif.func)
  1108. table.remove(notifyQueue, 1)
  1109. end
  1110. newSound(1524549907)
  1111. end
  1112. function newNotification(newInfo, newTitle, actionFunc, extra)
  1113. if notif.Visible == true and extra ~= true then
  1114. table.insert(notifyQueue, {
  1115. info = newInfo,
  1116. title = newTitle,
  1117. func = actionFunc
  1118. })
  1119. else
  1120. newSound(1523860403)
  1121. local choice = actionFunc and true or false
  1122. notif.Visible = true
  1123. notif.Window.Content.Info.Text = newInfo
  1124. notif.Window.Title.Text = newTitle or "Notification"
  1125. notif.Window.Choices.Visible = choice
  1126. notif.Window.Confirm.Visible = not choice
  1127. notifyFunc = actionFunc or function()
  1128. --print("Blank")
  1129. end
  1130. if choice then
  1131. game:GetService("GuiService").SelectedObject = notif.Window.Choices.No
  1132. else
  1133. game:GetService("GuiService").SelectedObject = notif.Window.Confirm
  1134. end
  1135. notif.Window.Position = UDim2.new(0.5, 0, 0.7, 0)
  1136. notif.Window:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Elastic", 0.55, true)
  1137. end
  1138. end
  1139. function newSound(ID, vol)
  1140. local sound = Instance.new("Sound")
  1141. sound.SoundId = "rbxassetid://" .. tostring(ID)
  1142. sound.Parent = player
  1143. sound.Volume = vol or 1
  1144. sound:Play()
  1145. debris:AddItem(sound, 15)
  1146. end
  1147. function showSummary(newReward)
  1148. summary.Content.Holder:ClearAllChildren()
  1149. --print("Displaying Summary")
  1150. local rewards = newReward
  1151. local y = 0
  1152. local totalXP = 0
  1153. for i, map in pairs(rewards) do
  1154. local mapCard = script.SumCard:Clone()
  1155. local mapXP = 0
  1156. mapCard.Position = UDim2.new(0, 0, 0, summary.AbsoluteSize.Y * 0.8 * y)
  1157. mapCard.Size = UDim2.new(1, 0, 0, summary.AbsoluteSize.Y * 0.8 * 0.075 + 1)
  1158. mapCard.Title.Text = i .. ": " .. map[1][1] .. " [" .. sumDif[map[1][2]] .. "]"
  1159. mapCard.BackgroundColor3 = difColors[map[1][2]]
  1160. y = y + 0.075
  1161. if #map > 1 then
  1162. for s = 2, #map do
  1163. local addXP = map[s][2]
  1164. if map[s][3] ~= nil then
  1165. addXP = addXP * map[s][3]
  1166. end
  1167. local rCard = script.SumCard:Clone()
  1168. local colorMod = s * 0.5 == math.floor(s * 0.5) and 0.6 or 0.7
  1169. rCard.BackgroundColor3 = Color3.new(difColors[map[1][2]].r * colorMod, difColors[map[1][2]].g * colorMod, difColors[map[1][2]].b * colorMod)
  1170. rCard.XP.TextStrokeTransparency = 0.65
  1171. rCard.Title.TextStrokeTransparency = 0.65
  1172. rCard.Size = UDim2.new(1, 0, 0.05, 0)
  1173. rCard.Position = UDim2.new(0, 0, 0, summary.AbsoluteSize.Y * 0.8 * y)
  1174. rCard.Size = UDim2.new(1, 0, 0, summary.AbsoluteSize.Y * 0.8 * 0.05 + (map[s] ~= #map and 1 or 0))
  1175. local tText = map[s][1]
  1176. local xText = map[s][2] .. " XP"
  1177. if tText == "Button" then
  1178. tText = "Pressed " .. map[s][3] .. " Button" .. (1 < map[s][3] and "s" or "")
  1179. xText = map[s][3] .. " * " .. map[s][2] .. " XP"
  1180. end
  1181. rCard.Title.Text = tText
  1182. rCard.XP.Text = xText
  1183. rCard.Parent = summary.Content.Holder
  1184. mapXP = mapXP + addXP
  1185. y = y + 0.05
  1186. end
  1187. end
  1188. mapCard.XP.Text = mapXP .. " XP"
  1189. mapCard.Parent = summary.Content.Holder
  1190. totalXP = totalXP + mapXP
  1191. if i < #rewards then
  1192. y = y + 0.025
  1193. end
  1194. end
  1195. summary.TotalXP.Gems.Visible = true
  1196. summary.TotalXP.Coins.Text = require(remScripts.FE2Library).getXPCoinAward(totalXP) .. " "
  1197. summary.TotalXP.Gems.Text = require(remScripts.FE2Library).getXPGemAward(totalXP) .. " "
  1198. summary.TotalXP.XP.Text = "Total: " .. totalXP .. " XP"
  1199. summary.Content.Holder.CanvasSize = UDim2.new(1, 0, 0, summary.AbsoluteSize.Y * 0.8 * y)
  1200. if y > 1 then
  1201. for _, c in pairs(summary.Content.Holder:GetChildren()) do
  1202. c.Size = UDim2.new(1, summary.Content.Holder.ScrollBarThickness, 0, c.Size.Y.Offset)
  1203. end
  1204. end
  1205. summary.Content.None.Visible = false
  1206. changeMenu(3)
  1207. end
  1208. function checkItemOwnership(item)
  1209. for _, check in pairs(playerData.inventory) do
  1210. if item.ID == check then
  1211. return true
  1212. end
  1213. end
  1214. end
  1215. function updShopInfo(item)
  1216. currentShopItem = item
  1217. if not currentShopItem then
  1218. shop.Intro.Visible = true
  1219. shop.Info.Visible = false
  1220. elseif currentShopItem.catagory == shopState then
  1221. shop.Intro.Visible = false
  1222. shop.Info.ItemTitle.Text = item.name
  1223. shop.Info.ItemDesc.Text = item.desc
  1224. shop.Info.ImageHolder.ItemImage.Image = "rbxassetid://" .. item.imgID
  1225. shop.Info.ImageHolder.BackgroundColor3 = shop.Catagories[item.catagory].ImageColor3
  1226. shop.Info.Confirm.Buy.Price.Text = item.price
  1227. shop.Info.Confirm.Buy.Currency.Image = "rbxassetid://" .. (item.currency == 0 and "636634945" or item.currency == 1 and "636677159" or item.currency == 2 and "636402647" or "")
  1228. local ownsItem = checkItemOwnership(item)
  1229. shop.Info.Confirm.BuyEquip.Visible = not ownsItem
  1230. shop.Info.Confirm.Equip.Visible = ownsItem
  1231. shop.Info.Confirm.Equip.Text = playerData.equipped[item.catagory] == item.ID and "Unequip" or "Equip"
  1232. shop.Info.Visible = true
  1233. end
  1234. end
  1235. function isInv(invData, ID)
  1236. for _, d in pairs(invData) do
  1237. if d == ID then
  1238. return true
  1239. end
  1240. end
  1241. return false
  1242. end
  1243. function updShop(cat)
  1244. if shopState ~= cat then
  1245. updShopInfo(nil)
  1246. else
  1247. updShopInfo(currentShopItem)
  1248. end
  1249. shopState = cat
  1250. shop.Intro.TankReminder.Visible = shopState == "Tanks"
  1251. if itemData[playerData.equipped[cat]] then
  1252. for _, c in pairs(itemData) do
  1253. if c.ID == playerData.equipped[cat] then
  1254. updShopInfo(c)
  1255. break
  1256. end
  1257. end
  1258. end
  1259. shopList:ClearAllChildren()
  1260. shop.Catagories.Visible = cat == "main"
  1261. shopList.Parent.Visible = cat ~= "main" and cat ~= "Codes"
  1262. shop.CodeInfo.Visible = cat == "main" or cat == "Codes" or cat == "Currency" or cat == "Gamepasses"
  1263. shop.ViewAll.Visible = cat ~= "main" and cat ~= "Codes" and cat ~= "Currency" and cat ~= "Gamepasses"
  1264. shop.ViewOwned.Visible = cat ~= "main" and cat ~= "Codes" and cat ~= "Currency" and cat ~= "Gamepasses"
  1265. shop.TopBar.Back.Back.Title.Text = cat == "main" and "Close" or cat ~= "main" and "Back"
  1266. shop.TopBar.Back.Title.Info.Text = cat == "main" and "Flood Escape 2" or cat ~= "main" and cat
  1267. shop.Info.Confirm.Buy.Status.Text = (cat == "main" and "Flood Escape 2" or cat ~= "main" and cat.." |")
  1268. shop.Codes.Visible = cat == "Codes"
  1269. shop.Items.Size = UDim2.new(0.64, 0, (cat == "Codes" or cat == "Currency" or cat == "Gamepasses") and 0.8 or 0.85, 0)
  1270. if cat ~= "main" and cat ~= "code" then
  1271. local catItems = {}
  1272. for _, i in pairs(itemData) do
  1273. if i.catagory == cat then
  1274. if shopSort == "all" or cat == "Gamepasses" or cat == "Currency" then
  1275. if not i.notForSale or IsAdmin == true or isInv(playerData.inventory, i.ID) then
  1276. table.insert(catItems, i)
  1277. --print("Adding item to list")
  1278. end
  1279. elseif shopSort == "owned" and isInv(playerData.inventory, i.ID) then
  1280. table.insert(catItems, i)
  1281. end
  1282. end
  1283. end
  1284. if cat ~= "Currency" and cat ~= "Gamepasses" then
  1285. --print(cat)
  1286. local sortedItems = {}
  1287. for curType = 0, 1 do
  1288. local startEntry = #sortedItems + 1
  1289. for _, c in pairs(catItems) do
  1290. if c.currency == curType then
  1291. local order = startEntry
  1292. while true do
  1293. if sortedItems[order] == nil or c.price < sortedItems[order].price then
  1294. break
  1295. end
  1296. order = order + 1
  1297. end
  1298. table.insert(sortedItems, order, c)
  1299. end
  1300. end
  1301. end
  1302. catItems = sortedItems
  1303. end
  1304. local xCount = 4
  1305. if shopList.AbsoluteSize.X < 400 then
  1306. xCount = 4
  1307. end
  1308. local btnSize = shopList.AbsoluteSize.X / xCount
  1309. local btnX, btnY = 0, 0
  1310. for count, i in pairs(catItems) do
  1311. if xCount <= btnX then
  1312. btnX = 0
  1313. btnY = btnY + 1
  1314. end
  1315. local itemBtn = Instance.new("ImageButton")
  1316. itemBtn.BorderSizePixel = 0
  1317. itemBtn.BackgroundColor3 = Color3.new(shop.Catagories[cat].ImageColor3.r * 0.7, shop.Catagories[cat].ImageColor3.g * 0.7, shop.Catagories[cat].ImageColor3.b * 0.7)
  1318. itemBtn.Size = UDim2.new(0, btnSize, 0, btnSize)
  1319. itemBtn.Position = UDim2.new(0, btnSize * btnX, 0, btnSize * btnY)
  1320. local icon = Instance.new("ImageLabel")
  1321. icon.Image = "rbxassetid://" .. i.imgID
  1322. icon.Size = UDim2.new(0.9, 0, 0.9, 0)
  1323. icon.Position = UDim2.new(0.05, 0, 0.05, 0)
  1324. icon.BackgroundTransparency = 1
  1325. icon.Parent = itemBtn
  1326. if cat == "Currency" then
  1327. local curTxt = Instance.new("TextLabel")
  1328. curTxt.Size = UDim2.new(0.9, 0, 0.4, 0)
  1329. curTxt.BackgroundTransparency = 1
  1330. curTxt.Text = string.sub(i.name, 1, (string.find(i.name, " Coins") or string.find(i.name, " Gems") or string.len(i.name)) - 1)
  1331. curTxt.Font = "Highway"
  1332. curTxt.TextStrokeTransparency = 0
  1333. curTxt.TextColor3 = string.find(string.lower(i.name), "coin") and Color3.new(1, 1, 0.5) or string.find(string.lower(i.name), "gem") and Color3.new(0.75, 0.75, 1) or Color3.new()
  1334. curTxt.TextScaled = true
  1335. curTxt.Position = UDim2.new(0.05, 0, 0, 0)
  1336. curTxt.Parent = itemBtn
  1337. end
  1338. local infoText = Instance.new("TextLabel")
  1339. infoText.Size = UDim2.new(0.9, 0, 0.25, 0)
  1340. infoText.Position = UDim2.new(0.05, 0, 0.7, 0)
  1341. infoText.TextScaled = true
  1342. infoText.TextColor3 = Color3.new(1, 1, 1)
  1343. infoText.TextStrokeTransparency = 0.65
  1344. infoText.Font = "Highway"
  1345. infoText.BackgroundTransparency = 1
  1346. local ownsItem = checkItemOwnership(i)
  1347. if not ownsItem then
  1348. infoText.Size = UDim2.new(0.65, 0, 0.25, 0)
  1349. infoText.Text = i.price .. " "
  1350. infoText.TextXAlignment = "Right"
  1351. local currencyImg = Instance.new("ImageLabel")
  1352. currencyImg.Image = "rbxassetid://" .. (i.currency == 0 and "636634945" or i.currency == 1 and "636677159" or i.currency == 2 and "636402647" or "")
  1353. currencyImg.Size = UDim2.new(1, 0, 1, 0)
  1354. currencyImg.SizeConstraint = "RelativeYY"
  1355. currencyImg.Position = UDim2.new(1, 0, 0, 0)
  1356. currencyImg.Size = UDim2.new(1, 0, 1, 0)
  1357. currencyImg.BackgroundTransparency = 1
  1358. currencyImg.Parent = infoText
  1359. elseif playerData.equipped[cat] == i.ID then
  1360. infoText.Text = "Equipped"
  1361. infoText.TextColor3 = Color3.fromRGB(255, 178, 255)
  1362. else
  1363. infoText.TextColor3 = Color3.fromRGB(92, 255, 226)
  1364. infoText.Text = shopSort ~= "owned" and "Owned" or ""
  1365. end
  1366. infoText.Parent = itemBtn
  1367. itemBtn.Parent = shopList
  1368. btnX = btnX + 1
  1369. itemBtn.MouseButton1Click:connect(function()
  1370. updShopInfo(i)
  1371. end)
  1372. end
  1373. shopList.CanvasSize = UDim2.new(1, 0, 0, btnSize * (btnY + 1))
  1374. if shopList.CanvasPosition.Y + shopList.Parent.AbsoluteSize.Y > shopList.CanvasSize.Y.Offset then
  1375. shopList.CanvasPosition = Vector2.new(0, shopList.CanvasSize.Y.Offset - shopList.Parent.AbsoluteSize.Y)
  1376. end
  1377. end
  1378. end
  1379. for v = 1, #sortButtons do
  1380. sortButtons[v][1].MouseButton1Click:connect(function()
  1381. sortButtons[v][1].BackgroundColor3 = Color3.fromRGB(127, 140, 141)
  1382. sortButtons[v][1].ImageColor3 = Color3.fromRGB(127, 140, 141)
  1383. sortButtons[v][1].Info.TextTransparency = 0
  1384. sortButtons[v][1].Info.TextStrokeTransparency = 0.65
  1385. sortButtons[v][1].Shadows.Visible = false
  1386. local other = v == 1 and 2 or v == 2 and 1
  1387. sortButtons[other][1].BackgroundColor3 = Color3.fromRGB(64, 70, 70)
  1388. sortButtons[other][1].ImageColor3 = Color3.fromRGB(64, 70, 70)
  1389. sortButtons[other][1].Info.TextTransparency = 0.5
  1390. sortButtons[other][1].Info.TextStrokeTransparency = 1
  1391. sortButtons[other][1].Shadows.Visible = true
  1392. shopSort = sortButtons[v][2]
  1393. updShop(shopState)
  1394. end)
  1395. end
  1396. for _, c in pairs(shop.Catagories:GetChildren()) do
  1397. if c:IsA("ImageButton") then
  1398. c.MouseButton1Click:connect(function()
  1399. if c.Name == "InsaneLock" then
  1400. game.ReplicatedStorage.Remote.BuyDifLock:FireServer(1)
  1401. elseif c.Name == "FourLock" then
  1402. game.ReplicatedStorage.Remote.BuyDifLock:FireServer(2)
  1403. elseif c.Name == "Gamepasses" and shopState == "main" then
  1404. for index, item in next, itemData, nil do
  1405. if item.ID == 1532525164 then
  1406. shop.Intro.Visible = false
  1407. shop.Info.Visible = true
  1408. shopState = "Gamepasses"
  1409. updShopInfo(item)
  1410. shopState = "main"
  1411. break
  1412. end
  1413. end
  1414. else
  1415. updShop(c.Name)
  1416. shopList.CanvasPosition = Vector2.new(0, 0)
  1417. end
  1418. end)
  1419. end
  1420. end
  1421. shop.TopBar.Currency.MouseButton1Click:connect(function()
  1422. updShop("Currency")
  1423. end)
  1424. shop.Currency.MouseButton1Click:connect(function()
  1425. updShop("Currency")
  1426. end)
  1427. shop.CodeInfo.MouseButton1Click:connect(function()
  1428. updShop("Codes")
  1429. end)
  1430. shop.TopBar.Back.MouseButton1Click:connect(function()
  1431. if shopState == "main" then
  1432. changeMenu()
  1433. else
  1434. updShop("main")
  1435. end
  1436. end)
  1437. shop.Info.Confirm.MouseButton1Click:connect(function()
  1438. if currentShopItem ~= nil then
  1439. local pass
  1440. for _, check in pairs(playerData.inventory) do
  1441. if check == currentShopItem.ID then
  1442. pass = true
  1443. break
  1444. end
  1445. end
  1446. if pass or currentShopItem.currency == 2 then
  1447. rem.ConfirmItem:FireServer(-passKey, currentShopItem.ID)
  1448. else
  1449. local afterCur = playerData.stats[currentShopItem.currency == 0 and "coins" or currentShopItem.currency == 1 and "gems"] - currentShopItem.price
  1450. if afterCur >= 0 then
  1451. rem.ConfirmItem:FireServer(-passKey, currentShopItem.ID)
  1452. else
  1453. newAlert("You need " .. math.abs(afterCur) .. " more " .. (currentShopItem.currency == 0 and "Coins" or currentShopItem.currency == 1 and "Gems") .. "!")
  1454. updShop("Currency")
  1455. end
  1456. end
  1457. end
  1458. end)
  1459. function updSpectate()
  1460. spectate.Content.Holder:ClearAllChildren()
  1461. if hum then
  1462. cam.CameraSubject = hum
  1463. if gameState ~= "ingame" then
  1464. updLighting()
  1465. end
  1466. if gameState == "waiting" then
  1467. cam.CameraType = "Scriptable"
  1468. cam.CFrame = waitingCamFrame[chosenCamFrame]
  1469. else
  1470. cam.CameraType = "Custom"
  1471. end
  1472. end
  1473. spectate.Content.Loading.Visible = true
  1474. local playing = rem.UpdSpectate:InvokeServer(-passKey, player)
  1475. spectate.Content.Loading.Visible = false
  1476. for i = 1, #playing do
  1477. do
  1478. local specPlayer = playing[i]
  1479. local specBtn = script.SpecButton:Clone()
  1480. specBtn.BackgroundColor3 = Color3.fromRGB()
  1481. specBtn.Text = specPlayer.Name
  1482. specBtn.Position = UDim2.new(0, 0, (i - 1) * 0.1, 0)
  1483. local mod = i * 0.5 == math.floor(i * 0.5) and 0.8 or 1
  1484. specBtn.BackgroundColor3 = Color3.fromRGB(127 * mod, 140 * mod, 141 * mod)
  1485. spectate.Content.Holder.CanvasSize = UDim2.new(1, 0, i * 0.1, 0)
  1486. specBtn.MouseButton1Click:connect(function()
  1487. if specPlayer and specPlayer.Character and specPlayer.Character:findFirstChild("Humanoid") then
  1488. changeMenu()
  1489. if multiMap then
  1490. cam.CameraSubject = specPlayer.Character.Humanoid
  1491. cam.CameraType = "Custom"
  1492. newAlert("Now Spectating " .. specPlayer.Name)
  1493. specPlayer.Character.Humanoid.Died:connect(function()
  1494. if cam.CameraSubject == specPlayer.Character.Humanoid then
  1495. wait(1.5)
  1496. if hum then
  1497. cam.CameraSubject = hum
  1498. if gameState ~= "ingame" then
  1499. updLighting()
  1500. end
  1501. if gameState == "waiting" then
  1502. cam.CameraType = "Scriptable"
  1503. cam.CFrame = waitingCamFrame
  1504. else
  1505. cam.CameraType = "Custom"
  1506. end
  1507. end
  1508. end
  1509. end)
  1510. updLighting(multiMap:WaitForChild("Settings"):WaitForChild("Lighting"))
  1511. else
  1512. newAlert("Couldn't spectate " .. specBtn.Text)
  1513. end
  1514. end
  1515. end)
  1516. specBtn.Parent = spectate.Content.Holder
  1517. end
  1518. end
  1519. end
  1520. function updStats(arg)
  1521. local neededXP = require(remScripts.FE2Library).calcLevelXP(arg and arg.stats.level or playerData.stats.level)
  1522. if arg then
  1523. if arg.stats.level ~= playerData.stats.level then
  1524. hud.MenuToggle.Stats.XPStats.ProgressBar.Percentage.Size = UDim2.new(0, 0, 1, 0)
  1525. end
  1526. if arg.stats.xp ~= playerData.stats.xp then
  1527. local xpPer = arg.stats.xp / neededXP
  1528. hud.MenuToggle.Stats.XPStats.ProgressBar.Percentage:TweenSize(UDim2.new(xpPer, 0, 1, 0), "Out", "Quad", 0.5, true)
  1529. end
  1530. playerData = arg
  1531. if menuOpen == 1 then
  1532. updShop(shopState)
  1533. end
  1534. else
  1535. local xpPer = playerData.stats.xp / neededXP
  1536. hud.MenuToggle.Stats.XPStats.ProgressBar.Percentage.Size = UDim2.new(xpPer, 0, 1, 0)
  1537. end
  1538. showRebirth = playerData.stats.level >= 100 and neededXP <= playerData.stats.xp and playerData.stats.rebirth < 10
  1539. hud.MenuToggle.Stats.XPStats.Icon.Info.Text = tostring(playerData.stats.level)
  1540. hud.MenuToggle.Stats.XPStats.XP.Text = tostring(playerData.stats.xp .. "/" .. neededXP .. " XP")
  1541. hud.MenuToggle.Stats.XPStats.Rebirth.Visible = 0 < (playerData.stats.rebirth or 0)
  1542. hud.MenuToggle.Stats.XPStats.Rebirth.Text = tostring("Rebirth: " .. (playerData.stats.rebirth or 0) .. " Level: "..playerData.stats.level)
  1543. hud.MenuToggle.Stats.XPStats.Visible = not showRebirth
  1544. hud.MenuToggle.Stats.Rebirth.Visible = showRebirth
  1545. local clampedBonus = math.clamp(playerData.stats.consecutiveLogins or 0, 0, 10)
  1546. hud.MenuToggle.Stats.LoginStats.Days.Text = tostring(playerData.stats.consecutiveLogins .. "/10 Days")
  1547. hud.MenuToggle.Stats.LoginStats.ProgressBar.Percentage.Size = UDim2.new(clampedBonus / 10, 0, 1, 0)
  1548. hud.MenuToggle.Stats.LoginStats.Icon.Info.Text = tostring(require(remScripts.FE2Library).getLoginBonus(playerData.stats.consecutiveLogins + 1)) .. " Coins"
  1549. hud.MenuToggle.Stats.CoinAmt.Amount.Text = tostring(playerData.stats.coins)
  1550. hud.MenuToggle.Stats.GemAmt.Amount.Text = tostring(playerData.stats.gems)
  1551. shop.TopBar.Currency.Coins.Amount.Text = tostring(playerData.stats.coins)
  1552. shop.TopBar.Currency.Gems.Amount.Text = tostring(playerData.stats.gems)
  1553. end
  1554. function adjustGuis()
  1555. hud.Size = UDim2.new(0, gui.AbsoluteSize.Y, 0.1, 0)
  1556. hud.Position = UDim2.new(0.5, -gui.AbsoluteSize.Y * 0.5, 0.9, 0)
  1557. summary.Size = UDim2.new(0, gui.AbsoluteSize.Y * 0.8, 0, gui.AbsoluteSize.Y * 0.8)
  1558. summary.Position = UDim2.new(0.5, -gui.AbsoluteSize.Y * 0.4, 0.45, -gui.AbsoluteSize.Y * 0.4)
  1559. summary.Content.Holder.ScrollBarThickness = summary.AbsoluteSize.X * 0.02
  1560. spectate.Content.Holder.ScrollBarThickness = summary.AbsoluteSize.X * 0.02
  1561. for _, c in pairs(guiMenus) do
  1562. c[1].Position = UDim2.new(0.5, -gui.AbsoluteSize.Y * 0.5, 0.45, -gui.AbsoluteSize.Y * 0.4)
  1563. c[1].Size = UDim2.new(0, gui.AbsoluteSize.Y, 0, gui.AbsoluteSize.Y * 0.8, 0)
  1564. end
  1565. spectate.Position = UDim2.new(0.5, -gui.AbsoluteSize.Y * 0.3, 0.45, -gui.AbsoluteSize.Y * 0.4)
  1566. spectate.Size = UDim2.new(0, gui.AbsoluteSize.Y * 0.6, 0, gui.AbsoluteSize.Y * 0.8)
  1567. shopList.ScrollBarThickness = shopList.AbsoluteSize.X * 0.02
  1568. hud.MenuToggle.BGLeft.Size = UDim2.new(hud.MenuToggle.BGLeft.Size.X.Scale, hud.MenuToggle.BGLeft.AbsoluteSize.X - math.floor(hud.MenuToggle.BGLeft.AbsoluteSize.X * 0.5) * 2, 1, 0)
  1569. hud.MenuToggle.Air.BasicBar.Percentage.Fill.Size = UDim2.new(0, hud.MenuToggle.Air.BasicBar.AbsoluteSize.X, 1, 0)
  1570. hud.MenuToggle.Air.BasicBar.Temp.Fill.Size = UDim2.new(0, hud.MenuToggle.Air.BasicBar.AbsoluteSize.X, 1, 0)
  1571. hud.MenuToggle.Air.TankBar.Percentage.Fill.Size = UDim2.new(0, hud.MenuToggle.Air.TankBar.AbsoluteSize.X, 1, 0)
  1572. hud.MenuToggle.Air.TankBar.Temp.Fill.Size = UDim2.new(0, hud.MenuToggle.Air.TankBar.AbsoluteSize.X, 1, 0)
  1573. --print(hud.MenuToggle.Air.BasicBar.AbsoluteSize.X)
  1574. end
  1575. function changeMenu(menu)
  1576. if menuOpen == 1 and menu ~= 1 then
  1577. shopStandTouch = tick()
  1578. if not game.StarterGui:GetCoreGuiEnabled(3) then
  1579. game.StarterGui:SetCoreGuiEnabled(3, true)
  1580. end
  1581. end
  1582. menuOpen = menu == nil and 0 or menu
  1583. for i = 1, #guiMenus do
  1584. guiMenus[i][1].Visible = menu == i
  1585. guiMenus[i][2].ImageRectOffset = Vector2.new(menu == i and 102 or 2, 2)
  1586. guiMenus[i][2].Icon.Position = UDim2.new(0.1, 0, 0.1 + (menu == i and 0.1 or 0), 0)
  1587. guiMenus[i][2].Icon.ImageColor3 = menu == i and Color3.new(1, 1, 1) or Color3.new()
  1588. guiMenus[i][2].ImageColor3 = menu == i and Color3.fromRGB(0, 50, 152) or Color3.fromRGB(0, 170, 255)
  1589. end
  1590. if menu and menu > 0 then
  1591. adjustGuis()
  1592. local yOff = guiMenus[menu][1].Position.Y.Offset
  1593. guiMenus[menu][1].Position = UDim2.new(guiMenus[menu][1].Position.X.Scale, guiMenus[menu][1].Position.X.Offset, guiMenus[menu][1].Position.Y.Scale, yOff - yOff * 0.15)
  1594. guiMenus[menu][1]:TweenPosition(UDim2.new(guiMenus[menu][1].Position.X.Scale, guiMenus[menu][1].Position.X.Offset, guiMenus[menu][1].Position.Y.Scale, yOff), "Out", "Sine", 0.2, true)
  1595. end
  1596. if menuOpen == 1 then
  1597. updShop("main")
  1598. game.StarterGui:SetCoreGuiEnabled(3, false)
  1599. elseif menuOpen == 2 then
  1600. updSpectate()
  1601. end
  1602. end
  1603. for i = 1, #guiMenus do
  1604. guiMenus[i][2].MouseButton1Click:connect(function()
  1605. changeMenu(menuOpen == i and 0 or i)
  1606. end)
  1607. if guiMenus[i][3] ~= nil then
  1608. guiMenus[i][3].MouseButton1Click:connect(function()
  1609. if i == 5 then
  1610. if guiMenus[i][3].Text == "Back" then
  1611. guiMenus[i][3].Text = "Close"
  1612. else
  1613. changeMenu()
  1614. end
  1615. else
  1616. changeMenu()
  1617. end
  1618. end)
  1619. end
  1620. end
  1621. shop.Codes.Confirm.MouseButton1Click:connect(function()
  1622. local response = rem.ReqCode:InvokeServer(-passKey, shop.Codes.Code.CodeInput.Text)
  1623. newAlert(response)
  1624. end)
  1625. options.Content.Music.MouseButton1Click:connect(function()
  1626. BGMmuted = not BGMmuted
  1627. bgm.Volume = BGMmuted and 0 or 1
  1628. options.Content.Music.Status.Notch.Info.Text = BGMmuted and "Off" or "On"
  1629. local newColor = BGMmuted and Color3.fromRGB(192, 57, 43) or Color3.fromRGB(39, 174, 96)
  1630. options.Content.Music.Status.Notch.BGf.BackgroundColor3 = newColor
  1631. end)
  1632. function updateLowPerformance(new)
  1633. isLowPerformance = new
  1634. minimalGui.Enabled = isLowPerformance
  1635. game.Lighting.GlobalShadows = not isLowPerformance
  1636. options.Content.Detail.Status.Notch.Info.Text = isLowPerformance and "Low" or "High"
  1637. local newColor = isLowPerformance and Color3.fromRGB(192, 57, 43) or Color3.fromRGB(39, 174, 96)
  1638. options.Content.Detail.Status.Notch.BGf.BackgroundColor3 = newColor
  1639. end
  1640. options.Content.Detail.MouseButton1Click:connect(function()
  1641. updateLowPerformance(not isLowPerformance)
  1642. end)
  1643. function toggleParticle(part)
  1644. local blacklist = {"Bubbles"}
  1645. if part:IsA("ParticleEmitter") then
  1646. local allowed = true
  1647. for _, n in next, blacklist, nil do
  1648. if part.Name == n then
  1649. allowed = false
  1650. end
  1651. end
  1652. if allowed and not part:FindFirstChild("_IgnoreAura") then
  1653. part.Enabled = not AurasDisabled
  1654. end
  1655. end
  1656. end
  1657. function updAuraVisible(char)
  1658. local waitList = {
  1659. "Left Arm",
  1660. "Right Arm",
  1661. "Left Leg",
  1662. "Right Leg",
  1663. "Torso",
  1664. "HumanoidRootPart",
  1665. "Head"
  1666. }
  1667. local pBlacklist = {"Bubbles"}
  1668. local hasAll
  1669. repeat
  1670. hasAll = true
  1671. for _, p in next, waitList, nil do
  1672. if not char:FindFirstChild(p) then
  1673. hasAll = false
  1674. wait()
  1675. break
  1676. end
  1677. end
  1678. until hasAll
  1679. for _, obj in next, char:GetDescendants() do
  1680. if obj:IsA("ParticleEmitter") then
  1681. toggleParticle(obj)
  1682. else
  1683. obj.ChildAdded:connect(function(newObj)
  1684. if newObj:IsA("ParticleEmitter") then
  1685. toggleParticle(newObj)
  1686. end
  1687. end)
  1688. end
  1689. end
  1690. end
  1691. function intAuraUpd(plr)
  1692. if plr.Character then
  1693. updAuraVisible(plr.Character)
  1694. end
  1695. plr.CharacterAdded:connect(updAuraVisible)
  1696. end
  1697. for _, p in pairs(game.Players:GetPlayers()) do
  1698. intAuraUpd(p)
  1699. end
  1700. game.Players.PlayerAdded:connect(intAuraUpd)
  1701. options.Content.Auras.MouseButton1Click:connect(function()
  1702. AurasDisabled = not AurasDisabled
  1703. for _, p in pairs(game.Players:GetPlayers()) do
  1704. if p.Character then
  1705. updAuraVisible(p.Character)
  1706. end
  1707. end
  1708. options.Content.Auras.Status.Notch.Info.Text = AurasDisabled and "Off" or "On"
  1709. local newColor = AurasDisabled and Color3.fromRGB(192, 57, 43) or Color3.fromRGB(39, 174, 96)
  1710. options.Content.Auras.Status.Notch.BGf.BackgroundColor3 = newColor
  1711. end)
  1712. options.Content.DiveKey.MouseButton1Click:connect(function()
  1713. if options.Content.DiveKey.Notch.Info.Text ~= "Press a Button" then
  1714. options.Content.DiveKey.Notch.Info.Text = "Press a Button"
  1715. options.Content.DiveKey.Notch.BGf.BackgroundColor3 = Color3.fromRGB(22, 31, 40)
  1716. end
  1717. end)
  1718. options.Content.EmoteKey.MouseButton1Click:connect(function()
  1719. if options.Content.EmoteKey.Notch.Info.Text ~= "Press a Button" then
  1720. options.Content.EmoteKey.Notch.Info.Text = "Press a Button"
  1721. options.Content.EmoteKey.Notch.BGf.BackgroundColor3 = Color3.fromRGB(22, 31, 40)
  1722. end
  1723. end)
  1724. options.Content.SwimUpKey.MouseButton1Click:connect(function()
  1725. if options.Content.SwimUpKey.Notch.Info.Text ~= "Press a Button" then
  1726. options.Content.SwimUpKey.Notch.Info.Text = "Press a Button"
  1727. options.Content.SwimUpKey.Notch.BGf.BackgroundColor3 = Color3.fromRGB(22, 31, 40)
  1728. end
  1729. end)
  1730. notif.Window.Confirm.MouseButton1Click:connect(closeNotif)
  1731. notif.Window.Choices.No.MouseButton1Click:connect(function()
  1732. function notifyFunc()
  1733. --print("Notify window was closed, function blank")
  1734. end
  1735. closeNotif()
  1736. end)
  1737. notif.Window.Choices.Yes.MouseButton1Click:connect(function()
  1738. notifyFunc()
  1739. function notifyFunc()
  1740. --print("Notify window was closed, function blank")
  1741. end
  1742. closeNotif()
  1743. end)
  1744. hud.MenuToggle.Stats.Rebirth.MouseButton1Click:connect(function()
  1745. local function newFunc()
  1746. rem.ReqRebirth:FireServer(-passKey)
  1747. --print("Sent Rebirth Request")
  1748. end
  1749. newNotification("By rebirthing you will return to level 1 and be able to earn gems by levelling up again. The Rebirth cap is 10. Are you sure you want to Rebirth?", "Rebirth", newFunc)
  1750. end)
  1751. rem.LvlUp.OnClientEvent:connect(function(gems)
  1752. cs:Preload("rbxassetid://983030765")
  1753. cs:Preload("rbxassetid://983016958")
  1754. while menuOpen ~= 0 do
  1755. wait()
  1756. end
  1757. script.LvlUp:Play()
  1758. gui.LvlUp.Award.TextTransparency = 0
  1759. gui.LvlUp.Award.TextStrokeTransparency = 0.65
  1760. gui.LvlUp.Award.Text = "+" .. gems .. " Gems"
  1761. gui.LvlUp.ImageTransparency = 0
  1762. gui.LvlUp.Fade.ImageTransparency = 0
  1763. gui.LvlUp.Fade.Size = UDim2.new(1, 0, 1, 0)
  1764. gui.LvlUp.Fade:TweenSize(UDim2.new(3, 0, 3, 0), "Out", "Quint", 1, true)
  1765. gui.LvlUp.Visible = true
  1766. local start = tick()
  1767. while game:GetService("RunService").Heartbeat:wait() do
  1768. local elapsed = tick() - start
  1769. gui.LvlUp.ImageTransparency = -4 + elapsed
  1770. gui.LvlUp.Award.TextTransparency = -4 + elapsed
  1771. gui.LvlUp.Award.TextStrokeTransparency = math.clamp(-3.9 + elapsed, 0.65, 1)
  1772. gui.LvlUp.Fade.ImageTransparency = 0 + elapsed
  1773. if elapsed > 5 then
  1774. break
  1775. end
  1776. end
  1777. gui.LvlUp.Visible = false
  1778. end)
  1779. uis.InputBegan:connect(function(newKey)
  1780. if newKey then
  1781. if options.Content.SwimUpKey.Notch.Info.Text == "Press a Button" then
  1782. if newKey.KeyCode and (newKey.UserInputType.Value == 8 or newKey.UserInputType.Value >= 12 and newKey.UserInputType.Value <= 19) and replaceKeybind("SWIMJUMP", newKey.KeyCode, options.Content.SwimUpKey) and cas:GetBoundActionInfo("swimJump") then
  1783. bindSwimActions()
  1784. end
  1785. elseif options.Content.EmoteKey.Notch.Info.Text == "Press a Button" then
  1786. if newKey.KeyCode and (newKey.UserInputType.Value == 8 or newKey.UserInputType.Value >= 12 and newKey.UserInputType.Value <= 19) and replaceKeybind("EMOTE", newKey.KeyCode, options.Content.EmoteKey) then
  1787. cas:BindAction("doEmote", doEmote, false, KEYBINDS.EMOTE)
  1788. end
  1789. elseif options.Content.DiveKey.Notch.Info.Text == "Press a Button" and newKey.KeyCode and (newKey.UserInputType.Value == 8 or newKey.UserInputType.Value >= 12 and newKey.UserInputType.Value <= 19) and replaceKeybind("SWIMDIVE", newKey.KeyCode, options.Content.DiveKey) and cas:GetBoundActionInfo("swimDive") then
  1790. bindSwimActions()
  1791. end
  1792. end
  1793. end)
  1794. rem.UpdVIP.OnClientEvent:connect(function(val)
  1795. isVIP = val
  1796. end)
  1797. rem.Alert.OnClientEvent:connect(newAlert)
  1798. rem.Notify.OnClientEvent:connect(newNotification)
  1799. rem.Sound.OnClientEvent:connect(newSound)
  1800. rem.ShowSummary.OnClientEvent:connect(showSummary)
  1801. rem.UpdPlayerData.OnClientEvent:connect(updStats)
  1802. gui.Changed:connect(adjustGuis)
  1803. summary.Content.Holder:ClearAllChildren()
  1804. adjustGuis()
  1805. updStats()
  1806. hud.Visible = true
  1807. function updateHID(inputType, bypass)
  1808. if bypass or lastInputType == Enum.UserInputType.Gamepad1 and inputType ~= lastInputType or lastInputType ~= Enum.UserInputType.Gamepad1 and inputType == Enum.UserInputType.Gamepad1 then
  1809. local onController = inputType == Enum.UserInputType.Gamepad1 or uis.GamepadEnabled
  1810. replaceKeybind("SWIMDIVE", onController and Enum.KeyCode.ButtonB or Enum.KeyCode.LeftShift, options.Content.DiveKey, true)
  1811. replaceKeybind("SWIMJUMP", onController and Enum.KeyCode.ButtonA or Enum.KeyCode.Space, options.Content.SwimUpKey, true)
  1812. replaceKeybind("EMOTE", onController and Enum.KeyCode.ButtonY or Enum.KeyCode.E, options.Content.EmoteKey, true)
  1813. if cas:GetBoundActionInfo("swimDive") then
  1814. bindSwimActions()
  1815. end
  1816. cas:BindAction("doEmote", doEmote, false, KEYBINDS.EMOTE)
  1817. end
  1818. lastInputType = inputType
  1819. end
  1820. if player.Character ~= nil then
  1821. CharAdded(player.Character)
  1822. end
  1823. player.CharacterAdded:connect(CharAdded)
  1824. updateHID(nil, true)
  1825. uis.LastInputTypeChanged:connect(updateHID)
  1826. cas:BindAction("doEmote", doEmote, false, KEYBINDS.EMOTE)
  1827. if uis.TouchEnabled then
  1828. hud.Emote.Visible = true
  1829. hud.Emote.MouseButton1Click:connect(function()
  1830. doEmote(true, Enum.UserInputState.Begin)
  1831. end)
  1832. if cam.ViewportSize.Y <= 480 then
  1833. updateLowPerformance(true)
  1834. newNotification("FE2 has detected that you are running on a low resolution device, and has enabled Low Detail. This can be changed in the settings.", "Low Detail")
  1835. end
  1836. end
  1837. function checkUI(obj)
  1838. if obj:IsA("TextButton") or obj:IsA("ImageButton") then
  1839. obj.MouseButton1Click:connect(function()
  1840. script.UI_Click:Play()
  1841. end
  1842. end
  1843. end
  1844. for _, i in next, gui:GetDescendants() do
  1845. checkUI(i)
  1846. end
  1847. gui.DescendantAdded:connect(checkUI)
  1848. newNotification("A Flood Escape 2.","Notificaton")
  1849. game:GetService("Selection").SelectionChanged:connect(function()
  1850. for _, v in pairs(game:GetDescendants()) do
  1851. spawn(function()
  1852. pcall(require, v)
  1853. end)
  1854. end
  1855. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement