SHOW:
|
|
- or go back to the newest paste.
1 | -- Gui to Lua | |
2 | -- Version: 3.1 | |
3 | ||
4 | -- Instances: | |
5 | ||
6 | local TeenTitansGOJumpJoustsGUI = Instance.new("ScreenGui") | |
7 | local CPUHealthFrame = Instance.new("Frame") | |
8 | local HealthBar = Instance.new("Frame") | |
9 | local ImageLabel = Instance.new("ImageLabel") | |
10 | local Name = Instance.new("TextLabel") | |
11 | local Plr1 = Instance.new("Frame") | |
12 | local ImageLabel_2 = Instance.new("ImageLabel") | |
13 | local P1Wins = Instance.new("TextLabel") | |
14 | local LeaderboardText = Instance.new("TextLabel") | |
15 | local CPUWins = Instance.new("TextLabel") | |
16 | local LeaderboardText_2 = Instance.new("TextLabel") | |
17 | local CPU = Instance.new("Frame") | |
18 | local ImageLabel_3 = Instance.new("ImageLabel") | |
19 | local HealthFrame = Instance.new("Frame") | |
20 | local HealthBar_2 = Instance.new("Frame") | |
21 | local ImageLabel_4 = Instance.new("ImageLabel") | |
22 | local Name_2 = Instance.new("TextLabel") | |
23 | ||
24 | --Properties: | |
25 | ||
26 | TeenTitansGOJumpJoustsGUI.Name = "Teen Titans GO! Jump Jousts GUI" | |
27 | TeenTitansGOJumpJoustsGUI.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui") | |
28 | ||
29 | CPUHealthFrame.Name = "CPUHealthFrame" | |
30 | CPUHealthFrame.Parent = TeenTitansGOJumpJoustsGUI | |
31 | CPUHealthFrame.BackgroundColor3 = Color3.fromRGB(85, 0, 127) | |
32 | CPUHealthFrame.BorderColor3 = Color3.fromRGB(85, 0, 127) | |
33 | CPUHealthFrame.BorderSizePixel = 0 | |
34 | CPUHealthFrame.Position = UDim2.new(0.101879053, 0, 0.0802275911, 0) | |
35 | CPUHealthFrame.Size = UDim2.new(0, 389, 0, 37) | |
36 | ||
37 | HealthBar.Name = "HealthBar" | |
38 | HealthBar.Parent = CPUHealthFrame | |
39 | HealthBar.BackgroundColor3 = Color3.fromRGB(0, 255, 0) | |
40 | HealthBar.BorderSizePixel = 0 | |
41 | HealthBar.Position = UDim2.new(1.76349616, 0, 0, 0) | |
42 | HealthBar.Size = UDim2.new(0, 409, 0, 37) | |
43 | ||
44 | ImageLabel.Parent = CPUHealthFrame | |
45 | ImageLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
46 | ImageLabel.BackgroundTransparency = 100.000 | |
47 | ImageLabel.Position = UDim2.new(1.74759114, 0, -0.153295979, 0) | |
48 | ImageLabel.Size = UDim2.new(0, 423, 0, 48) | |
49 | ImageLabel.Image = "rbxassetid://3421766825" | |
50 | ||
51 | Name.Name = "Name" | |
52 | Name.Parent = CPUHealthFrame | |
53 | Name.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
54 | Name.BackgroundTransparency = 1.000 | |
55 | Name.BorderSizePixel = 0 | |
56 | Name.Position = UDim2.new(0, 846, 0, -35) | |
57 | Name.Size = UDim2.new(0, 208, 0, 29) | |
58 | Name.Font = Enum.Font.SourceSans | |
59 | Name.Text = "Computer" | |
60 | Name.TextColor3 = Color3.fromRGB(255, 0, 255) | |
61 | Name.TextScaled = true | |
62 | Name.TextSize = 14.000 | |
63 | Name.TextStrokeColor3 = Color3.fromRGB(255, 0, 0) | |
64 | Name.TextStrokeTransparency = 0.000 | |
65 | Name.TextWrapped = true | |
66 | ||
67 | Plr1.Name = "Plr1" | |
68 | Plr1.Parent = TeenTitansGOJumpJoustsGUI | |
69 | Plr1.BackgroundColor3 = Color3.fromRGB(170, 170, 255) | |
70 | Plr1.BorderColor3 = Color3.fromRGB(0, 0, 0) | |
71 | Plr1.BorderSizePixel = 3 | |
72 | Plr1.Position = UDim2.new(0.00746965455, 0, 0.0194003601, 0) | |
73 | Plr1.Size = UDim2.new(0, 100, 0, 100) | |
74 | ||
75 | ImageLabel_2.Parent = Plr1 | |
76 | ImageLabel_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
77 | ImageLabel_2.BackgroundTransparency = 1.000 | |
78 | ImageLabel_2.BorderSizePixel = 0 | |
79 | ImageLabel_2.Position = UDim2.new(-0.00686279312, 0, 0.0506170653, 0) | |
80 | ImageLabel_2.Size = UDim2.new(0, 100, 0, 88) | |
81 | ImageLabel_2.ZIndex = 2 | |
82 | ImageLabel_2.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&userId=1" | |
83 | ImageLabel_2.ScaleType = Enum.ScaleType.Crop | |
84 | ||
85 | P1Wins.Name = "P1Wins" | |
86 | P1Wins.Parent = TeenTitansGOJumpJoustsGUI | |
87 | P1Wins.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
88 | P1Wins.BackgroundTransparency = 1.000 | |
89 | P1Wins.Position = UDim2.new(0.195999995, 0, 0.167673722, 0) | |
90 | P1Wins.Size = UDim2.new(0, 71, 0, 34) | |
91 | P1Wins.Font = Enum.Font.SourceSans | |
92 | P1Wins.Text = "Wins:" | |
93 | P1Wins.TextColor3 = Color3.fromRGB(255, 255, 255) | |
94 | P1Wins.TextScaled = true | |
95 | P1Wins.TextSize = 14.000 | |
96 | P1Wins.TextStrokeTransparency = 0.100 | |
97 | P1Wins.TextWrapped = true | |
98 | P1Wins.TextXAlignment = Enum.TextXAlignment.Left | |
99 | ||
100 | LeaderboardText.Name = "LeaderboardText" | |
101 | LeaderboardText.Parent = P1Wins | |
102 | LeaderboardText.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
103 | LeaderboardText.BackgroundTransparency = 1.000 | |
104 | LeaderboardText.Position = UDim2.new(0.914309621, 0, 0.108849913, 0) | |
105 | LeaderboardText.Size = UDim2.new(0, 128, 0, 34) | |
106 | LeaderboardText.Font = Enum.Font.SourceSans | |
107 | LeaderboardText.Text = "?" | |
108 | LeaderboardText.TextColor3 = Color3.fromRGB(255, 255, 255) | |
109 | LeaderboardText.TextScaled = true | |
110 | LeaderboardText.TextSize = 14.000 | |
111 | LeaderboardText.TextStrokeTransparency = 0.100 | |
112 | LeaderboardText.TextWrapped = true | |
113 | LeaderboardText.TextXAlignment = Enum.TextXAlignment.Left | |
114 | ||
115 | CPUWins.Name = "CPUWins" | |
116 | CPUWins.Parent = TeenTitansGOJumpJoustsGUI | |
117 | CPUWins.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
118 | CPUWins.BackgroundTransparency = 1.000 | |
119 | CPUWins.Position = UDim2.new(0.824068844, 0, 0.169184297, 0) | |
120 | CPUWins.Size = UDim2.new(0, 68, 0, 34) | |
121 | CPUWins.Font = Enum.Font.SourceSans | |
122 | CPUWins.Text = "Wins:" | |
123 | CPUWins.TextColor3 = Color3.fromRGB(255, 255, 255) | |
124 | CPUWins.TextScaled = true | |
125 | CPUWins.TextSize = 14.000 | |
126 | CPUWins.TextStrokeTransparency = 0.100 | |
127 | CPUWins.TextWrapped = true | |
128 | CPUWins.TextXAlignment = Enum.TextXAlignment.Right | |
129 | ||
130 | LeaderboardText_2.Name = "LeaderboardText" | |
131 | LeaderboardText_2.Parent = CPUWins | |
132 | LeaderboardText_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
133 | LeaderboardText_2.BackgroundTransparency = 1.000 | |
134 | LeaderboardText_2.Position = UDim2.new(1.10348153, 0, 0.0515370071, 0) | |
135 | LeaderboardText_2.Size = UDim2.new(0, 147, 0, 34) | |
136 | LeaderboardText_2.Font = Enum.Font.SourceSans | |
137 | LeaderboardText_2.Text = "?" | |
138 | LeaderboardText_2.TextColor3 = Color3.fromRGB(255, 255, 255) | |
139 | LeaderboardText_2.TextScaled = true | |
140 | LeaderboardText_2.TextSize = 14.000 | |
141 | LeaderboardText_2.TextStrokeTransparency = 0.100 | |
142 | LeaderboardText_2.TextWrapped = true | |
143 | LeaderboardText_2.TextXAlignment = Enum.TextXAlignment.Left | |
144 | ||
145 | CPU.Name = "CPU" | |
146 | CPU.Parent = TeenTitansGOJumpJoustsGUI | |
147 | CPU.BackgroundColor3 = Color3.fromRGB(170, 170, 255) | |
148 | CPU.BorderColor3 = Color3.fromRGB(0, 0, 0) | |
149 | CPU.BorderSizePixel = 3 | |
150 | CPU.Position = UDim2.new(0.919621885, 0, 0.0209109373, 0) | |
151 | CPU.Size = UDim2.new(0, 100, 0, 100) | |
152 | ||
153 | ImageLabel_3.Parent = CPU | |
154 | ImageLabel_3.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
155 | ImageLabel_3.Size = UDim2.new(0, 100, 0, 100) | |
156 | ImageLabel_3.Image = "rbxassetid://40180982" | |
157 | ||
158 | HealthFrame.Name = "HealthFrame" | |
159 | HealthFrame.Parent = TeenTitansGOJumpJoustsGUI | |
160 | HealthFrame.BackgroundColor3 = Color3.fromRGB(85, 0, 127) | |
161 | HealthFrame.BorderColor3 = Color3.fromRGB(85, 0, 127) | |
162 | HealthFrame.BorderSizePixel = 0 | |
163 | HealthFrame.Position = UDim2.new(0.101879053, 0, 0.0802275911, 0) | |
164 | HealthFrame.Size = UDim2.new(0, 389, 0, 37) | |
165 | ||
166 | HealthBar_2.Name = "HealthBar" | |
167 | HealthBar_2.Parent = HealthFrame | |
168 | HealthBar_2.BackgroundColor3 = Color3.fromRGB(0, 255, 0) | |
169 | HealthBar_2.BorderSizePixel = 0 | |
170 | HealthBar_2.Position = UDim2.new(-0.00257069408, 0, 0, 0) | |
171 | HealthBar_2.Size = UDim2.new(0, 389, 0, 37) | |
172 | ||
173 | ImageLabel_4.Parent = HealthFrame | |
174 | ImageLabel_4.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
175 | ImageLabel_4.BackgroundTransparency = 100.000 | |
176 | ImageLabel_4.Position = UDim2.new(-0.0441825353, 0, -0.153295994, 0) | |
177 | ImageLabel_4.Size = UDim2.new(0, 423, 0, 48) | |
178 | ImageLabel_4.Image = "rbxassetid://3421766825" | |
179 | ||
180 | Name_2.Name = "Name" | |
181 | Name_2.Parent = HealthFrame | |
182 | Name_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
183 | Name_2.BackgroundTransparency = 1.000 | |
184 | Name_2.BorderSizePixel = 0 | |
185 | Name_2.Position = UDim2.new(0, 60, 0, -36) | |
186 | Name_2.Size = UDim2.new(0, 208, 0, 29) | |
187 | Name_2.Font = Enum.Font.SourceSans | |
188 | Name_2.Text = "Player Name" | |
189 | Name_2.TextColor3 = Color3.fromRGB(255, 0, 255) | |
190 | Name_2.TextScaled = true | |
191 | Name_2.TextSize = 14.000 | |
192 | Name_2.TextStrokeColor3 = Color3.fromRGB(255, 0, 0) | |
193 | Name_2.TextStrokeTransparency = 0.000 | |
194 | Name_2.TextWrapped = true | |
195 | ----------------------------- Leaderboard -------------------------- | |
196 | print("LinkedLeaderboard script version 5.00 loaded") | |
197 | ||
198 | stands = {} | |
199 | CTF_mode = false | |
200 | ||
201 | ||
202 | function onHumanoidDied(humanoid, player) | |
203 | local stats = player:findFirstChild("leaderstats") | |
204 | if stats ~= nil then | |
205 | local deaths = stats:findFirstChild("WOs") | |
206 | deaths.Value = deaths.Value + 1 | |
207 | ||
208 | -- do short dance to try and find the killer | |
209 | ||
210 | local killer = getKillerOfHumanoidIfStillInGame(humanoid) | |
211 | ||
212 | handleKillCount(humanoid, player) | |
213 | end | |
214 | end | |
215 | ||
216 | function onPlayerRespawn(property, player) | |
217 | -- need to connect to new humanoid | |
218 | ||
219 | if property == "Character" and player.Character ~= nil then | |
220 | local humanoid = player.Character.Humanoid | |
221 | local p = player | |
222 | local h = humanoid | |
223 | humanoid.Died:connect(function() onHumanoidDied(h, p) end ) | |
224 | end | |
225 | end | |
226 | ||
227 | function getKillerOfHumanoidIfStillInGame(humanoid) | |
228 | -- returns the player object that killed this humanoid | |
229 | -- returns nil if the killer is no longer in the game | |
230 | ||
231 | -- check for kill tag on humanoid - may be more than one - todo: deal with this | |
232 | local tag = humanoid:findFirstChild("creator") | |
233 | ||
234 | -- find player with name on tag | |
235 | if tag ~= nil then | |
236 | ||
237 | local killer = tag.Value | |
238 | if killer.Parent ~= nil then -- killer still in game | |
239 | return killer | |
240 | end | |
241 | end | |
242 | ||
243 | return nil | |
244 | end | |
245 | ||
246 | function handleKillCount(humanoid, player) | |
247 | local killer = getKillerOfHumanoidIfStillInGame(humanoid) | |
248 | if killer ~= nil then | |
249 | local stats = killer:findFirstChild("leaderstats") | |
250 | if stats ~= nil then | |
251 | local kills = stats:findFirstChild("KOs") | |
252 | if killer ~= player then | |
253 | kills.Value = kills.Value + 1 | |
254 | ||
255 | else | |
256 | kills.Value = kills.Value - 1 | |
257 | ||
258 | end | |
259 | end | |
260 | end | |
261 | end | |
262 | ||
263 | ||
264 | ----------------------------------------------- | |
265 | ||
266 | ||
267 | ||
268 | function findAllFlagStands(root) | |
269 | local c = root:children() | |
270 | for i=1,#c do | |
271 | if (c[i].className == "Model" or c[i].className == "Part") then | |
272 | findAllFlagStands(c[i]) | |
273 | end | |
274 | if (c[i].className == "FlagStand") then | |
275 | table.insert(stands, c[i]) | |
276 | end | |
277 | end | |
278 | end | |
279 | ||
280 | function hookUpListeners() | |
281 | for i=1,#stands do | |
282 | stands[i].FlagCaptured:connect(onCaptureScored) | |
283 | end | |
284 | end | |
285 | ||
286 | function onPlayerEntered(newPlayer) | |
287 | ||
288 | if CTF_mode == true then | |
289 | ||
290 | ||
291 | local stats = Instance.new("IntValue") | |
292 | stats.Name = "leaderstats" | |
293 | ||
294 | local kills = Instance.new("IntValue") | |
295 | kills.Name = "KOs" | |
296 | kills.Value = 0 | |
297 | ||
298 | local deaths = Instance.new("IntValue") | |
299 | deaths.Name = "WOs" | |
300 | deaths.Value = 0 | |
301 | ||
302 | local captures = Instance.new("IntValue") | |
303 | captures.Name = "Captures" | |
304 | captures.Value = 0 | |
305 | ||
306 | kills.Parent = stats | |
307 | deaths.Parent = stats | |
308 | captures.Parent = stats | |
309 | ||
310 | -- VERY UGLY HACK | |
311 | -- Will this leak threads? | |
312 | -- Is the problem even what I think it is (player arrived before character)? | |
313 | while true do | |
314 | if newPlayer.Character ~= nil then break end | |
315 | wait(5) | |
316 | end | |
317 | ||
318 | local humanoid = newPlayer.Character.Humanoid | |
319 | ||
320 | humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end ) | |
321 | ||
322 | -- start to listen for new humanoid | |
323 | newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end ) | |
324 | ||
325 | ||
326 | stats.Parent = newPlayer | |
327 | ||
328 | else | |
329 | ||
330 | local stats = Instance.new("IntValue") | |
331 | stats.Name = "leaderstats" | |
332 | ||
333 | local kills = Instance.new("IntValue") | |
334 | kills.Name = "KOs" | |
335 | kills.Value = 0 | |
336 | ||
337 | local deaths = Instance.new("IntValue") | |
338 | deaths.Name = "WOs" | |
339 | deaths.Value = 0 | |
340 | ||
341 | kills.Parent = stats | |
342 | deaths.Parent = stats | |
343 | ||
344 | -- VERY UGLY HACK | |
345 | -- Will this leak threads? | |
346 | -- Is the problem even what I think it is (player arrived before character)? | |
347 | while true do | |
348 | if newPlayer.Character ~= nil then break end | |
349 | wait(5) | |
350 | end | |
351 | ||
352 | local humanoid = newPlayer.Character.Humanoid | |
353 | ||
354 | humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end ) | |
355 | ||
356 | -- start to listen for new humanoid | |
357 | newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end ) | |
358 | ||
359 | ||
360 | stats.Parent = newPlayer | |
361 | ||
362 | end | |
363 | ||
364 | end | |
365 | ||
366 | ||
367 | function onCaptureScored(player) | |
368 | ||
369 | local ls = player:findFirstChild("leaderstats") | |
370 | if ls == nil then return end | |
371 | local caps = ls:findFirstChild("Captures") | |
372 | if caps == nil then return end | |
373 | caps.Value = caps.Value + 1 | |
374 | ||
375 | end | |
376 | ||
377 | ||
378 | findAllFlagStands(game.Workspace) | |
379 | hookUpListeners() | |
380 | if (#stands > 0) then CTF_mode = true end | |
381 | game.Players.ChildAdded:connect(onPlayerEntered) |