Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- local player = game.Players.LocalPlayer
- local char = player.Character or player.CharacterAdded:wait()
- local mouse = player:GetMouse()
- local camera = workspace.CurrentCamera
- local RepStore = game.ReplicatedStorage
- local Events = RepStore.Events
- local Checkpoints = workspace.CheckPoints
- local ContentProvider = game:GetService("ContentProvider")
- local RunService = game:GetService("RunService")
- local TweenService = game:GetService("TweenService")
- local UserInput = game:GetService("UserInputService")
- local network = {}
- local screen = {}
- local gui = script.Parent
- local Audio = gui.Audio
- local Main = gui.Main
- -- Functions
- do -- network
- network.key = 0
- function network.handleEvent(key,eventKey,...)
- if key ~= network.key then return print("your gay please die") end
- network.key = network.key + 5*2.5/9/7.2
- local args = {...}
- print(eventKey)
- if eventKey == "LevelPassed" then
- local lvl = args[1]
- if lvl and tonumber(lvl) then
- if game.Lighting:FindFirstChild("Sky "..lvl-1) then game.Lighting:FindFirstChild("Sky "..lvl-1):Destroy() end
- gui.Parent["Sky "..lvl]:Clone().Parent = game.Lighting
- local Screen = screen.new(Color3.new(1,1,1),"LevelPassed Event")
- Screen.In(0.2)
- wait(1)
- Screen.Out(0.2)
- end
- elseif eventKey == "Screen" then
- local color = args[1]
- local time = args[2]
- local uptime = args[3]
- local Screen = screen.new(color,"Screen Event")
- Screen.In(time)
- wait(uptime)
- Screen.Out(time)
- end
- end
- function network.sendFunction(eventKey,...)
- network.key = network.key + 5*2.5/9/7.2
- return Events.RemoteFunction:InvokeServer(network.key,eventKey,...)
- end
- function network.sendEvent(eventKey,...)
- network.key = network.key + 5*2.5/9/7.2
- Events.RemoteEvent:FireServer(network.key,eventKey,...)
- end
- end
- do -- screen
- function screen.new(color,caller)
- print("SCREEN CALLER",caller)
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(1,0,1.1,0)
- frame.Position = UDim2.new(0,0,-0.1,0)
- frame.BorderSizePixel = 0
- frame.BackgroundTransparency = 1
- frame.BackgroundColor3 = color
- frame.Parent = gui
- local Events = {
- In = function(time) TweenService:Create(frame,TweenInfo.new(time),{BackgroundTransparency = 0}):Play() end,
- Out = function(time) TweenService:Create(frame,TweenInfo.new(time),{BackgroundTransparency = 1}):Play() wait(time) frame:Destroy() end
- }
- return Events
- end
- end
- -- Loading Screen
- spawn(function()
- local Intro = gui["Loading Screen"]
- Main.Visible = false
- Intro.Black.Visible = true
- Intro.clip.Visible = true
- Intro.clip.Background_.Visible = true
- Audio.Intro:Play()
- while ContentProvider.RequestQueueSize > 0 do
- Intro.clip.Background_.Image = "rbxgameasset://Images/loading1"
- wait(0.5)
- Intro.clip.Background_.Image = "rbxgameasset://Images/loading2"
- wait(0.5)
- Intro.clip.Background_.Image = "rbxgameasset://Images/loading3"
- wait(0.5)
- end
- wait(1)
- Intro.clip.Background_:TweenPosition(UDim2.new(0.5,0,1.5,0), "Out", "Quad", .5)
- wait(.5)
- Main.Visible = true
- game.Lighting.Blur.Size = gui.Configuration.BlurSize.Value
- TweenService:Create(Intro.Black,TweenInfo.new(0.5),{ImageTransparency = 1}):Play()
- end)
- -- Initial shit
- for i,v in pairs(Main:GetChildren()) do
- if v:IsA("ImageButton") then
- v.MouseEnter:Connect(function()
- v.Size = v.Size + UDim2.new(0,10,0,10)
- v.Position = v.Position - UDim2.new(0,5,0,5)
- end)
- v.MouseLeave:Connect(function()
- v.Size = v.Size - UDim2.new(0,10,0,10)
- v.Position = v.Position + UDim2.new(0,5,0,5)
- end)
- end
- end
- Events.RemoteEvent.OnClientEvent:Connect(network.handleEvent)
- -- Menu shit
- local inMenu = true
- local RunMenu = RunService.RenderStepped:Connect(function()
- camera.CameraType = Enum.CameraType.Scriptable
- camera.CFrame = workspace.CamDisplay.CameraPart.CFrame * CFrame.new(5,10,5) * CFrame.new(0,math.rad(math.sin(tick()))*200,0)
- end)
- local Run = RunService.RenderStepped:Connect(function()
- gui.Cursor.Position = UDim2.new(0,mouse.X,0,mouse.Y)
- UserInput.MouseIconEnabled = false
- end)
- spawn(function()
- while inMenu do
- local particle = Instance.new("Frame")
- particle.AnchorPoint = Vector2.new(0.5,0.5)
- particle.BackgroundColor3 = Color3.new(1,1,1)
- particle.BorderSizePixel = 0
- particle.Size = UDim2.new(0,5,0,5)
- particle.Position = UDim2.new(0,mouse.X,0,mouse.Y)
- particle.Parent = gui.Particles
- TweenService:Create(particle,TweenInfo.new(0.3),{BackgroundTransparency = 1,Rotation = math.random(-45,45)}):Play()
- game:GetService("Debris"):AddItem(particle,0.22)
- RunService.RenderStepped:wait()
- end
- end)
- local Modes = {
- ["Normal"] = {
- ImageID = "rbxgameasset://Images/gamemode_normal_2",
- Size = UDim2.new(0,500,0,60),
- Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
- OnClick = function()
- Audio.Intro:Stop()
- RunMenu:Disconnect()
- inMenu = false
- Main.Visible = false
- game.Lighting.Blur.Size = 0
- repeat workspace.CurrentCamera.CameraType = Enum.CameraType.Custom wait() until workspace.CurrentCamera.CameraType == Enum.CameraType.Custom
- local Screen = screen.new(Color3.new(1,1,1),"Modes")
- Screen.In(0.5)
- local stage = network.sendFunction("GetStage") or 1
- char.Humanoid.WalkSpeed = network.sendFunction("GetStageData",stage).Speed
- wait(2)
- char:MoveTo(Checkpoints[stage].Position)
- Screen.Out(0.5)
- end
- },
- ["User Made Levels (WIP)"] = {
- ImageID = "rbxgameasset://Images/coollogo_com-11542288",
- Size = UDim2.new(0,400,0,65),
- Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
- OnClick = function()
- end
- },
- ["Race (WIP)"] = {
- ImageID = "rbxgameasset://Images/gamemode_race_1",
- Size = UDim2.new(0,500,0,65),
- Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
- OnClick = function()
- end
- },
- }
- local open = false
- Main.Play.MouseButton1Click:Connect(function()
- Audio.ButtonClick:Play()
- if not open then
- open = true
- local last = Main.Play.Position + UDim2.new(0,15,Main.Play.Size.Y.Scale,Main.Play.Size.Y.Offset)
- for i,v in pairs(Modes) do
- if not Main:FindFirstChild(i) then
- local btn = Instance.new("ImageButton")
- btn.BackgroundTransparency = 1
- btn.ImageTransparency = 1
- btn.Name = i
- btn.Image = v.ImageID
- btn.Size = v.Size
- btn.Position = v.Start
- TweenService:Create(btn,TweenInfo.new(0.5),{Position = last, ImageTransparency = 0}):Play()
- last = last + UDim2.new(0,0,btn.Size.Y.Scale,btn.Size.Y.Offset + 15)
- btn.Parent = Main
- btn.MouseButton1Click:Connect(v.OnClick)
- wait(.1)
- else
- local btn = Main:FindFirstChild(i)
- TweenService:Create(btn,TweenInfo.new(0.5),{Position = last, ImageTransparency = 0}):Play()
- last = last + UDim2.new(0,0,btn.Size.Y.Scale,btn.Size.Y.Offset + 15)
- wait(.1)
- end
- end
- elseif open then
- open = false
- for i,v in pairs(Modes) do
- local btn = Main:FindFirstChild(i)
- TweenService:Create(btn,TweenInfo.new(0.5),{Position = v.Start, ImageTransparency = 1}):Play()
- wait(.1)
- end
- end
- end)
- Main.About.MouseButton1Click:Connect(function()
- gui.About.Position = UDim2.new(0.5, -400,1, 0)
- gui.About:TweenPosition(UDim2.new(0.5, -400, 0.5, -276), "Out", "Bounce", .5)
- Main.Visible = false
- end)
- gui.About.CloseAbout.MouseButton1Click:Connect(function()
- gui.About:TweenPosition(UDim2.new(0.5, -400, 3, 0), "Out", "Bounce", .5)
- Main.Visible = true
- end)
- -- view distancing
- spawn(function()
- local ignoredNames = {
- ["CutscenePlayer"] = true,
- ["R"] = true,
- ["Respawn"] = true,
- ["EndOfLvl"] = true,
- ["HumanoidRootPart"] = true,
- ["Torso"] = true,
- ["Cloud"] = 0.5
- }
- for i,v in pairs(workspace.Cameras:GetChildren()) do
- ignoredNames[v.Name] = true
- end
- for i,v in pairs(workspace.CheckPoints:GetChildren()) do
- ignoredNames[v.Name] = true
- end
- for i,v in pairs(workspace.Lights:GetChildren()) do
- ignoredNames[v.Name] = true
- end
- for i,v in pairs(workspace["SkyBox changers"]:GetChildren()) do
- ignoredNames[v.Name] = true
- end
- while wait(1) do
- for i,v in pairs(workspace:GetDescendants()) do
- if v:IsA("BasePart") and not v:IsDescendantOf(char) then
- local m = (camera.CFrame.Position - v.Position).magnitude
- if m > 500 then
- v.Transparency = 1
- elseif m < 500 and v:FindFirstChild("StayTransparent") or m < 500 and ignoredNames[v.Name] then
- if type(ignoredNames[v.Name]) == "number" then
- v.Transparency = ignoredNames[v.Name]
- end
- else
- v.Transparency = 0
- end
- end
- --wait()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment