Guest User

Untitled

a guest
Feb 9th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.63 KB | None | 0 0
  1. -- Variables
  2. local player = game.Players.LocalPlayer
  3. local char = player.Character or player.CharacterAdded:wait()
  4. local mouse = player:GetMouse()
  5. local camera = workspace.CurrentCamera
  6. local RepStore = game.ReplicatedStorage
  7. local Events = RepStore.Events
  8. local Checkpoints = workspace.CheckPoints
  9.  
  10. local ContentProvider = game:GetService("ContentProvider")
  11. local RunService = game:GetService("RunService")
  12. local TweenService = game:GetService("TweenService")
  13. local UserInput = game:GetService("UserInputService")
  14.  
  15. local network = {}
  16. local screen = {}
  17.  
  18. local gui = script.Parent
  19. local Audio = gui.Audio
  20. local Main = gui.Main
  21.  
  22. -- Functions
  23.  
  24. do -- network
  25. network.key = 0
  26.  
  27. function network.handleEvent(key,eventKey,...)
  28. if key ~= network.key then return print("your gay please die") end
  29. network.key = network.key + 5*2.5/9/7.2
  30. local args = {...}
  31. print(eventKey)
  32. if eventKey == "LevelPassed" then
  33. local lvl = args[1]
  34. if lvl and tonumber(lvl) then
  35. if game.Lighting:FindFirstChild("Sky "..lvl-1) then game.Lighting:FindFirstChild("Sky "..lvl-1):Destroy() end
  36. gui.Parent["Sky "..lvl]:Clone().Parent = game.Lighting
  37.  
  38. local Screen = screen.new(Color3.new(1,1,1),"LevelPassed Event")
  39. Screen.In(0.2)
  40. wait(1)
  41. Screen.Out(0.2)
  42. end
  43. elseif eventKey == "Screen" then
  44. local color = args[1]
  45. local time = args[2]
  46. local uptime = args[3]
  47.  
  48. local Screen = screen.new(color,"Screen Event")
  49. Screen.In(time)
  50. wait(uptime)
  51. Screen.Out(time)
  52. end
  53. end
  54.  
  55. function network.sendFunction(eventKey,...)
  56. network.key = network.key + 5*2.5/9/7.2
  57. return Events.RemoteFunction:InvokeServer(network.key,eventKey,...)
  58.  
  59. end
  60. function network.sendEvent(eventKey,...)
  61. network.key = network.key + 5*2.5/9/7.2
  62. Events.RemoteEvent:FireServer(network.key,eventKey,...)
  63. end
  64. end
  65.  
  66. do -- screen
  67. function screen.new(color,caller)
  68. print("SCREEN CALLER",caller)
  69. local frame = Instance.new("Frame")
  70. frame.Size = UDim2.new(1,0,1.1,0)
  71. frame.Position = UDim2.new(0,0,-0.1,0)
  72. frame.BorderSizePixel = 0
  73. frame.BackgroundTransparency = 1
  74. frame.BackgroundColor3 = color
  75. frame.Parent = gui
  76.  
  77. local Events = {
  78. In = function(time) TweenService:Create(frame,TweenInfo.new(time),{BackgroundTransparency = 0}):Play() end,
  79. Out = function(time) TweenService:Create(frame,TweenInfo.new(time),{BackgroundTransparency = 1}):Play() wait(time) frame:Destroy() end
  80. }
  81.  
  82. return Events
  83. end
  84. end
  85.  
  86. -- Loading Screen
  87. spawn(function()
  88. local Intro = gui["Loading Screen"]
  89. Main.Visible = false
  90. Intro.Black.Visible = true
  91. Intro.clip.Visible = true
  92. Intro.clip.Background_.Visible = true
  93. Audio.Intro:Play()
  94. while ContentProvider.RequestQueueSize > 0 do
  95. Intro.clip.Background_.Image = "rbxgameasset://Images/loading1"
  96. wait(0.5)
  97. Intro.clip.Background_.Image = "rbxgameasset://Images/loading2"
  98. wait(0.5)
  99. Intro.clip.Background_.Image = "rbxgameasset://Images/loading3"
  100. wait(0.5)
  101. end
  102. wait(1)
  103.  
  104. Intro.clip.Background_:TweenPosition(UDim2.new(0.5,0,1.5,0), "Out", "Quad", .5)
  105. wait(.5)
  106. Main.Visible = true
  107. game.Lighting.Blur.Size = gui.Configuration.BlurSize.Value
  108. TweenService:Create(Intro.Black,TweenInfo.new(0.5),{ImageTransparency = 1}):Play()
  109. end)
  110.  
  111. -- Initial shit
  112. for i,v in pairs(Main:GetChildren()) do
  113. if v:IsA("ImageButton") then
  114. v.MouseEnter:Connect(function()
  115. v.Size = v.Size + UDim2.new(0,10,0,10)
  116. v.Position = v.Position - UDim2.new(0,5,0,5)
  117. end)
  118.  
  119. v.MouseLeave:Connect(function()
  120. v.Size = v.Size - UDim2.new(0,10,0,10)
  121. v.Position = v.Position + UDim2.new(0,5,0,5)
  122. end)
  123. end
  124. end
  125.  
  126. Events.RemoteEvent.OnClientEvent:Connect(network.handleEvent)
  127.  
  128. -- Menu shit
  129. local inMenu = true
  130.  
  131. local RunMenu = RunService.RenderStepped:Connect(function()
  132. camera.CameraType = Enum.CameraType.Scriptable
  133. camera.CFrame = workspace.CamDisplay.CameraPart.CFrame * CFrame.new(5,10,5) * CFrame.new(0,math.rad(math.sin(tick()))*200,0)
  134. end)
  135.  
  136. local Run = RunService.RenderStepped:Connect(function()
  137. gui.Cursor.Position = UDim2.new(0,mouse.X,0,mouse.Y)
  138. UserInput.MouseIconEnabled = false
  139. end)
  140.  
  141. spawn(function()
  142. while inMenu do
  143. local particle = Instance.new("Frame")
  144. particle.AnchorPoint = Vector2.new(0.5,0.5)
  145. particle.BackgroundColor3 = Color3.new(1,1,1)
  146. particle.BorderSizePixel = 0
  147. particle.Size = UDim2.new(0,5,0,5)
  148. particle.Position = UDim2.new(0,mouse.X,0,mouse.Y)
  149. particle.Parent = gui.Particles
  150.  
  151. TweenService:Create(particle,TweenInfo.new(0.3),{BackgroundTransparency = 1,Rotation = math.random(-45,45)}):Play()
  152. game:GetService("Debris"):AddItem(particle,0.22)
  153. RunService.RenderStepped:wait()
  154. end
  155. end)
  156.  
  157. local Modes = {
  158. ["Normal"] = {
  159. ImageID = "rbxgameasset://Images/gamemode_normal_2",
  160. Size = UDim2.new(0,500,0,60),
  161. Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
  162. OnClick = function()
  163. Audio.Intro:Stop()
  164. RunMenu:Disconnect()
  165. inMenu = false
  166. Main.Visible = false
  167. game.Lighting.Blur.Size = 0
  168. repeat workspace.CurrentCamera.CameraType = Enum.CameraType.Custom wait() until workspace.CurrentCamera.CameraType == Enum.CameraType.Custom
  169. local Screen = screen.new(Color3.new(1,1,1),"Modes")
  170. Screen.In(0.5)
  171. local stage = network.sendFunction("GetStage") or 1
  172. char.Humanoid.WalkSpeed = network.sendFunction("GetStageData",stage).Speed
  173. wait(2)
  174. char:MoveTo(Checkpoints[stage].Position)
  175. Screen.Out(0.5)
  176. end
  177. },
  178. ["User Made Levels (WIP)"] = {
  179. ImageID = "rbxgameasset://Images/coollogo_com-11542288",
  180. Size = UDim2.new(0,400,0,65),
  181. Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
  182. OnClick = function()
  183.  
  184. end
  185. },
  186. ["Race (WIP)"] = {
  187. ImageID = "rbxgameasset://Images/gamemode_race_1",
  188. Size = UDim2.new(0,500,0,65),
  189. Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
  190. OnClick = function()
  191.  
  192. end
  193. },
  194. }
  195.  
  196. local open = false
  197. Main.Play.MouseButton1Click:Connect(function()
  198. Audio.ButtonClick:Play()
  199.  
  200. if not open then
  201. open = true
  202. local last = Main.Play.Position + UDim2.new(0,15,Main.Play.Size.Y.Scale,Main.Play.Size.Y.Offset)
  203.  
  204. for i,v in pairs(Modes) do
  205. if not Main:FindFirstChild(i) then
  206. local btn = Instance.new("ImageButton")
  207. btn.BackgroundTransparency = 1
  208. btn.ImageTransparency = 1
  209. btn.Name = i
  210.  
  211. btn.Image = v.ImageID
  212. btn.Size = v.Size
  213. btn.Position = v.Start
  214. TweenService:Create(btn,TweenInfo.new(0.5),{Position = last, ImageTransparency = 0}):Play()
  215. last = last + UDim2.new(0,0,btn.Size.Y.Scale,btn.Size.Y.Offset + 15)
  216. btn.Parent = Main
  217.  
  218. btn.MouseButton1Click:Connect(v.OnClick)
  219. wait(.1)
  220. else
  221. local btn = Main:FindFirstChild(i)
  222. TweenService:Create(btn,TweenInfo.new(0.5),{Position = last, ImageTransparency = 0}):Play()
  223. last = last + UDim2.new(0,0,btn.Size.Y.Scale,btn.Size.Y.Offset + 15)
  224. wait(.1)
  225. end
  226. end
  227. elseif open then
  228. open = false
  229. for i,v in pairs(Modes) do
  230. local btn = Main:FindFirstChild(i)
  231. TweenService:Create(btn,TweenInfo.new(0.5),{Position = v.Start, ImageTransparency = 1}):Play()
  232. wait(.1)
  233. end
  234. end
  235. end)
  236.  
  237. Main.About.MouseButton1Click:Connect(function()
  238. gui.About.Position = UDim2.new(0.5, -400,1, 0)
  239. gui.About:TweenPosition(UDim2.new(0.5, -400, 0.5, -276), "Out", "Bounce", .5)
  240. Main.Visible = false
  241. end)
  242.  
  243. gui.About.CloseAbout.MouseButton1Click:Connect(function()
  244. gui.About:TweenPosition(UDim2.new(0.5, -400, 3, 0), "Out", "Bounce", .5)
  245. Main.Visible = true
  246. end)
  247.  
  248. -- view distancing
  249. spawn(function()
  250. local ignoredNames = {
  251. ["CutscenePlayer"] = true,
  252. ["R"] = true,
  253. ["Respawn"] = true,
  254. ["EndOfLvl"] = true,
  255. ["HumanoidRootPart"] = true,
  256. ["Torso"] = true,
  257. ["Cloud"] = 0.5
  258. }
  259. for i,v in pairs(workspace.Cameras:GetChildren()) do
  260. ignoredNames[v.Name] = true
  261. end
  262. for i,v in pairs(workspace.CheckPoints:GetChildren()) do
  263. ignoredNames[v.Name] = true
  264. end
  265. for i,v in pairs(workspace.Lights:GetChildren()) do
  266. ignoredNames[v.Name] = true
  267. end
  268. for i,v in pairs(workspace["SkyBox changers"]:GetChildren()) do
  269. ignoredNames[v.Name] = true
  270. end
  271. while wait(1) do
  272. for i,v in pairs(workspace:GetDescendants()) do
  273. if v:IsA("BasePart") and not v:IsDescendantOf(char) then
  274. local m = (camera.CFrame.Position - v.Position).magnitude
  275. if m > 500 then
  276. v.Transparency = 1
  277. elseif m < 500 and v:FindFirstChild("StayTransparent") or m < 500 and ignoredNames[v.Name] then
  278. if type(ignoredNames[v.Name]) == "number" then
  279. v.Transparency = ignoredNames[v.Name]
  280. end
  281. else
  282. v.Transparency = 0
  283. end
  284. end
  285. --wait()
  286. end
  287. end
  288. end)
Advertisement
Add Comment
Please, Sign In to add comment