View difference between Paste ID: kyV35yac and MT97j05r
SHOW: | | - or go back to the newest paste.
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
7+
8-
local Checkpoints = workspace.CheckPoints
8+
9
local RunService = game:GetService("RunService")
10
local TweenService = game:GetService("TweenService")
11
local UserInput = game:GetService("UserInputService")
12
13
local network = {}
14
local screen = {}
15
16
local gui = script.Parent
17
local Audio = gui.Audio
18
local Main = gui.Main
19
20
do -- screen
21
	function screen.new(color,caller)
22-
-- Functions
22+
23
		local frame = Instance.new("Frame")
24-
do -- network
24+
25-
	network.key = 0
25+
26
		frame.BorderSizePixel = 0
27-
	function network.handleEvent(key,eventKey,...)
27+
28-
		if key ~= network.key then return print("your gay please die") end
28+
29-
		network.key = network.key + 5*2.5/9/7.2
29+
30-
		local args = {...}
30+
31-
		print(eventKey)
31+
32-
		if eventKey == "LevelPassed" then
32+
33-
			local lvl = args[1]
33+
34-
			if lvl and tonumber(lvl) then
34+
35-
				if game.Lighting:FindFirstChild("Sky "..lvl-1) then game.Lighting:FindFirstChild("Sky "..lvl-1):Destroy() end
35+
36-
				gui.Parent["Sky "..lvl]:Clone().Parent = game.Lighting
36+
37
	end
38-
				local Screen = screen.new(Color3.new(1,1,1),"LevelPassed Event")
38+
39-
				Screen.In(0.2)
39+
40-
				wait(1)
40+
41-
				Screen.Out(0.2)
41+
42
	local Intro = gui["Loading Screen"]
43-
		elseif eventKey == "Screen" then
43+
44-
			local color = args[1]
44+
45-
			local time = args[2]
45+
46-
			local uptime = args[3]
46+
47
	Audio.Intro:Play()
48-
			local Screen = screen.new(color,"Screen Event")
48+
49-
			Screen.In(time)
49+
50-
			wait(uptime)
50+
51-
			Screen.Out(time)
51+
52
		wait(0.5)
53
		Intro.clip.Background_.Image = "rbxgameasset://Images/loading3"
54
		wait(0.5)
55-
	function network.sendFunction(eventKey,...)
55+
56-
		network.key = network.key + 5*2.5/9/7.2
56+
57-
		return Events.RemoteFunction:InvokeServer(network.key,eventKey,...)
57+
58
	Intro.clip.Background_:TweenPosition(UDim2.new(0.5,0,1.5,0), "Out", "Quad", .5)
59
	wait(.5)
60-
	function network.sendEvent(eventKey,...)
60+
61-
		network.key = network.key + 5*2.5/9/7.2
61+
62-
		Events.RemoteEvent:FireServer(network.key,eventKey,...)
62+
63
end)
64
65
-- Initial shit
66
for i,v in pairs(Main:GetChildren()) do
67
	if v:IsA("ImageButton") then
68
		v.MouseEnter:Connect(function()
69
			v.Size = v.Size + UDim2.new(0,10,0,10)
70
			v.Position = v.Position - UDim2.new(0,5,0,5)
71
		end)
72
		
73
		v.MouseLeave:Connect(function()
74
			v.Size = v.Size - UDim2.new(0,10,0,10)
75
			v.Position = v.Position + UDim2.new(0,5,0,5)
76
		end)
77
	end
78
end
79
80
-- Menu shit
81
local inMenu = true
82
83
local Run = RunService.RenderStepped:Connect(function()
84
	gui.Cursor.Position = UDim2.new(0,mouse.X,0,mouse.Y)
85
	UserInput.MouseIconEnabled = false
86
end)
87
88
spawn(function()
89
	while inMenu do
90
		local particle = Instance.new("Frame")
91
		particle.AnchorPoint = Vector2.new(0.5,0.5)
92
		particle.BackgroundColor3 = Color3.new(1,1,1)
93
		particle.BorderSizePixel = 0
94
		particle.Size = UDim2.new(0,5,0,5)
95
		particle.Position = UDim2.new(0,mouse.X,0,mouse.Y)
96
		particle.Parent = gui.Particles
97
		
98
		TweenService:Create(particle,TweenInfo.new(0.3),{BackgroundTransparency = 1,Rotation = math.random(-45,45)}):Play()
99
		game:GetService("Debris"):AddItem(particle,0.22)
100
		RunService.RenderStepped:wait()
101
	end
102
end)
103
104
local Modes = {
105
	["Normal"] = {
106
		ImageID = "rbxgameasset://Images/gamemode_normal_2",
107
		Size = UDim2.new(0,500,0,60),
108
		Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
109
		OnClick = function()
110
			Audio.Intro:Stop()
111
			inMenu = false
112
			Main.Visible = false 
113
			repeat workspace.CurrentCamera.CameraType = Enum.CameraType.Custom wait() until workspace.CurrentCamera.CameraType == Enum.CameraType.Custom
114
			local Screen = screen.new(Color3.new(1,1,1),"Modes")
115
			Screen.In(0.5)
116
			wait(2)
117
			Screen.Out(0.5)
118
		end
119
	},
120
	["User Made Levels (WIP)"] = {
121
		ImageID = "rbxgameasset://Images/coollogo_com-11542288",
122
		Size = UDim2.new(0,400,0,65),
123
		Start = Main.Play.Position + UDim2.new(0,0,0,50),--UDim2.new(math.random(),0,-0.2,0),
124
		OnClick = function()
125
			
126-
Events.RemoteEvent.OnClientEvent:Connect(network.handleEvent)
126+
127
	},
128
	["Race (WIP)"] = {
129
		ImageID = "rbxgameasset://Images/gamemode_race_1",
130
		Size = UDim2.new(0,500,0,65),
131-
local RunMenu = RunService.RenderStepped:Connect(function()
131+
132-
	camera.CameraType = Enum.CameraType.Scriptable
132+
133-
	camera.CFrame = workspace.CamDisplay.CameraPart.CFrame * CFrame.new(5,10,5) * CFrame.new(0,math.rad(math.sin(tick()))*200,0)
133+
134
		end
135
	},
136
}
137
138
local open = false
139
Main.Play.MouseButton1Click:Connect(function()
140
	Audio.ButtonClick:Play()
141
	
142
	if not open then
143
		open = true
144
		local last = Main.Play.Position + UDim2.new(0,15,Main.Play.Size.Y.Scale,Main.Play.Size.Y.Offset)
145
		
146
		for i,v in pairs(Modes) do
147
			if not Main:FindFirstChild(i) then
148
				local btn = Instance.new("ImageButton")
149
				btn.BackgroundTransparency = 1
150
				btn.ImageTransparency = 1
151
				btn.Name = i		
152
				
153
				btn.Image = v.ImageID
154
				btn.Size = v.Size
155
				btn.Position = v.Start
156
				TweenService:Create(btn,TweenInfo.new(0.5),{Position = last, ImageTransparency = 0}):Play()
157
				last = last + UDim2.new(0,0,btn.Size.Y.Scale,btn.Size.Y.Offset + 15)
158
				btn.Parent = Main
159
				
160
				btn.MouseButton1Click:Connect(v.OnClick)
161
				wait(.1)
162
			else
163
				local btn = Main:FindFirstChild(i)
164-
			RunMenu:Disconnect()
164+
165
				last = last + UDim2.new(0,0,btn.Size.Y.Scale,btn.Size.Y.Offset + 15)
166-
			Main.Visible = false
166+
167-
			game.Lighting.Blur.Size = 0
167+
168
		end
169
	elseif open then
170
		open = false
171-
			local stage = network.sendFunction("GetStage") or 1
171+
172-
			char.Humanoid.WalkSpeed = network.sendFunction("GetStageData",stage).Speed
172+
173
			TweenService:Create(btn,TweenInfo.new(0.5),{Position = v.Start, ImageTransparency = 1}):Play()
174-
			char:MoveTo(Checkpoints[stage].Position)
174+
175
		end
176
	end
177
end)
178
179
Main.About.MouseButton1Click:Connect(function()
180
	gui.About.Position = UDim2.new(0.5, -400,1, 0)
181
	gui.About:TweenPosition(UDim2.new(0.5, -400, 0.5, -276), "Out", "Bounce", .5)
182
	Main.Visible = false
183
end)
184
185
gui.About.CloseAbout.MouseButton1Click:Connect(function()
186
	gui.About:TweenPosition(UDim2.new(0.5, -400, 3, 0), "Out", "Bounce", .5)
187
	Main.Visible = true
188
end)