· 8 years ago · Apr 06, 2018, 08:46 PM
1
2--Converted with ttyyuu12345's model to script plugin v4
3function sandbox(var,func)
4 local env = getfenv(func)
5 local newenv = setmetatable({},{
6 __index = function(self,k)
7 if k=="script" then
8 return var
9 else
10 return env[k]
11 end
12 end,
13 })
14 setfenv(func,newenv)
15 return func
16end
17cors = {}
18mas = Instance.new("Model",game:GetService("Lighting"))
19ScreenGui0 = Instance.new("ScreenGui")
20LocalScript1 = Instance.new("LocalScript")
21Frame2 = Instance.new("Frame")
22TextButton3 = Instance.new("TextButton")
23TextButton4 = Instance.new("TextButton")
24TextButton5 = Instance.new("TextButton")
25TextButton6 = Instance.new("TextButton")
26TextButton7 = Instance.new("TextButton")
27TextButton8 = Instance.new("TextButton")
28TextButton9 = Instance.new("TextButton")
29TextLabel10 = Instance.new("TextLabel")
30Frame11 = Instance.new("Frame")
31TextButton12 = Instance.new("TextButton")
32TextButton13 = Instance.new("TextButton")
33TextLabel14 = Instance.new("TextLabel")
34Sound15 = Instance.new("Sound")
35Frame16 = Instance.new("Frame")
36TextLabel17 = Instance.new("TextLabel")
37TextLabel18 = Instance.new("TextLabel")
38ImageButton19 = Instance.new("ImageButton")
39Frame20 = Instance.new("Frame")
40TextLabel21 = Instance.new("TextLabel")
41TextBox22 = Instance.new("TextBox")
42TextButton23 = Instance.new("TextButton")
43Frame24 = Instance.new("Frame")
44TextLabel25 = Instance.new("TextLabel")
45TextLabel26 = Instance.new("TextLabel")
46Frame27 = Instance.new("Frame")
47TextLabel28 = Instance.new("TextLabel")
48TextButton29 = Instance.new("TextButton")
49TextButton30 = Instance.new("TextButton")
50TextLabel31 = Instance.new("TextLabel")
51TextLabel32 = Instance.new("TextLabel")
52ImageButton33 = Instance.new("ImageButton")
53ScreenGui0.Name = "ROBLOXGui"
54ScreenGui0.Parent = mas
55LocalScript1.Parent = ScreenGui0
56table.insert(cors,sandbox(LocalScript1,function()
57game.Players.LocalPlayer:WaitForChild("PlayerGui"):SetTopbarTransparency(1)
58Player = game.Players.LocalPlayer
59Menu = script.Parent
60MenuButton = Menu.MenuButton
61SettingsFrame = Menu.MenuFrame
62Resume = Menu.MenuFrame.Resume
63Exit = Menu.MenuFrame.Exit
64Reset = Menu.MenuFrame.Reset
65Settings = Menu.MenuFrame.Settings
66LeaveFrame = Menu.LeaveFrame
67Stay = Menu.LeaveFrame.Stay
68Leave = Menu.LeaveFrame.Leave
69Help = Menu.MenuFrame.Help
70Fart = Menu.Fart
71FartFrame = Menu.FartFrame
72ReportFrame = Menu.ReportFrame
73ReportSubmit = Menu.ReportFrame.ReportSubmit
74TrickedFrame = Menu.TrickedFrame
75ReportButton = Menu.MenuFrame.Report
76ResetFrame1 = Menu.ResetFrame
77ResetButton1 = Menu.ResetFrame.Reset
78AdminButton1 = Menu.MenuFrame.Admin
79
80
81
82function PlayGame()
83 SettingsFrame.Visible = true
84
85end
86
87function ResumeGame()
88 SettingsFrame.Visible = false
89
90end
91
92function ExitGame()
93 SettingsFrame.Visible = false
94 LeaveFrame.Visible = true
95
96end
97
98function StayGame()
99 SettingsFrame.Visible = true
100 LeaveFrame.Visible = false
101
102end
103
104function LeaveGame()
105 game.Players.LocalPlayer:Kick("You Have Left The Game")
106end
107
108function ResetCharcter1()
109 SettingsFrame.Visible = false
110 ResetFrame1.Visible = true
111end
112
113function ResetCharcter2()
114 SettingsFrame.Visible = false
115 ResetFrame1.Visible = false
116 game.Players.LocalPlayer.Character.Humanoid.Health = 0
117end
118
119function FartCharcter()
120 game.Players.LocalPlayer.Character.Humanoid.Health = 0
121 Fart:Play()
122 SettingsFrame.Visible = false
123 FartFrame.Visible = true
124end
125
126function Tricked()
127 ReportFrame.Visible = false
128 TrickedFrame.Visible = true
129 wait (3)
130 game.Players.LocalPlayer:Kick("get rekt bra")
131end
132function Report()
133 SettingsFrame.Visible = false
134 ReportFrame.Visible = true
135end
136
137function Admin1()
138
139end
140
141
142
143MenuButton.MouseButton1Down:connect(PlayGame)
144Resume.MouseButton1Down:connect(ResumeGame)
145Exit.MouseButton1Down:connect(ExitGame)
146Reset.MouseButton1Down:connect(ResetCharcter1)
147ResetButton1.MouseButton1Down:connect(ResetCharcter2)
148Stay.MouseButton1Down:connect(StayGame)
149Leave.MouseButton1Down:connect(LeaveGame)
150Help.MouseButton1Down:connect(FartCharcter)
151ReportButton.MouseButton1Down:connect(Report)
152ReportSubmit.MouseButton1Down:connect(Tricked)
153AdminButton1.MouseButton1Down:connect(Admin1)
154
155
156end))
157Frame2.Name = "MenuFrame"
158Frame2.Parent = ScreenGui0
159Frame2.Size = UDim2.new(0, 522, 0, 468)
160Frame2.Style = Enum.FrameStyle.RobloxRound
161Frame2.Position = UDim2.new(0.5, -300, 0.5, -250)
162Frame2.Visible = false
163Frame2.BackgroundColor3 = Color3.new(1, 1, 1)
164TextButton3.Name = "Resume"
165TextButton3.Parent = Frame2
166TextButton3.Size = UDim2.new(0, 359, 0, 50)
167TextButton3.Style = Enum.ButtonStyle.RobloxButtonDefault
168TextButton3.Text = "Resume Game"
169TextButton3.Position = UDim2.new(0.144636005, 0, 0.147224367, 0)
170TextButton3.BackgroundColor3 = Color3.new(1, 1, 1)
171TextButton3.Font = Enum.Font.ArialBold
172TextButton3.FontSize = Enum.FontSize.Size24
173TextButton3.TextColor3 = Color3.new(1, 1, 1)
174TextButton4.Name = "Exit"
175TextButton4.Parent = Frame2
176TextButton4.Size = UDim2.new(0, 366, 0, 50)
177TextButton4.Style = Enum.ButtonStyle.RobloxButtonDefault
178TextButton4.Text = "Exit Game"
179TextButton4.Position = UDim2.new(0.143678159, 0, 0.858159781, 0)
180TextButton4.BackgroundColor3 = Color3.new(1, 1, 1)
181TextButton4.Font = Enum.Font.ArialBold
182TextButton4.FontSize = Enum.FontSize.Size24
183TextButton4.TextColor3 = Color3.new(1, 1, 1)
184TextButton5.Name = "Reset"
185TextButton5.Parent = Frame2
186TextButton5.Size = UDim2.new(0, 359, 0, 50)
187TextButton5.Style = Enum.ButtonStyle.RobloxButtonDefault
188TextButton5.Text = "Reset Charcter"
189TextButton5.Position = UDim2.new(0.141762435, 0, 0.271974564, 0)
190TextButton5.BackgroundColor3 = Color3.new(1, 1, 1)
191TextButton5.Font = Enum.Font.ArialBold
192TextButton5.FontSize = Enum.FontSize.Size24
193TextButton5.TextColor3 = Color3.new(1, 1, 1)
194TextButton6.Name = "Settings"
195TextButton6.Parent = Frame2
196TextButton6.Size = UDim2.new(0, 359, 0, 50)
197TextButton6.Style = Enum.ButtonStyle.RobloxButtonDefault
198TextButton6.Text = "Settings"
199TextButton6.Position = UDim2.new(0.142720282, 0, 0.395270407, 0)
200TextButton6.BackgroundColor3 = Color3.new(1, 1, 1)
201TextButton6.Font = Enum.Font.ArialBold
202TextButton6.FontSize = Enum.FontSize.Size24
203TextButton6.TextColor3 = Color3.new(1, 1, 1)
204TextButton7.Name = "Report"
205TextButton7.Parent = Frame2
206TextButton7.Size = UDim2.new(0, 178, 0, 50)
207TextButton7.Style = Enum.ButtonStyle.RobloxButtonDefault
208TextButton7.Text = "Report Abuse"
209TextButton7.Position = UDim2.new(0.14176245, 0, 0.727268159, 0)
210TextButton7.BackgroundColor3 = Color3.new(1, 1, 1)
211TextButton7.Font = Enum.Font.ArialBold
212TextButton7.FontSize = Enum.FontSize.Size24
213TextButton7.TextColor3 = Color3.new(1, 1, 1)
214TextButton8.Name = "Help"
215TextButton8.Parent = Frame2
216TextButton8.Size = UDim2.new(0, 178, 0, 50)
217TextButton8.Style = Enum.ButtonStyle.RobloxButtonDefault
218TextButton8.Text = "Help"
219TextButton8.Position = UDim2.new(0.139846742, 0, 0.592158794, 0)
220TextButton8.BackgroundColor3 = Color3.new(1, 1, 1)
221TextButton8.Font = Enum.Font.ArialBold
222TextButton8.FontSize = Enum.FontSize.Size24
223TextButton8.TextColor3 = Color3.new(1, 1, 1)
224TextButton9.Name = "Admin"
225TextButton9.Parent = Frame2
226TextButton9.Size = UDim2.new(0, 178, 0, 50)
227TextButton9.Style = Enum.ButtonStyle.RobloxButtonDefault
228TextButton9.Text = "ROBLOX"
229TextButton9.Position = UDim2.new(0.503831387, 0, 0.590022027, 0)
230TextButton9.BackgroundColor3 = Color3.new(1, 1, 1)
231TextButton9.Font = Enum.Font.ArialBold
232TextButton9.FontSize = Enum.FontSize.Size24
233TextButton9.TextColor3 = Color3.new(1, 1, 1)
234TextLabel10.Parent = Frame2
235TextLabel10.Transparency = 0
236TextLabel10.Size = UDim2.new(0, 200, 0, 50)
237TextLabel10.Text = "Game Menu"
238TextLabel10.Position = UDim2.new(0.298850566, 0, 0.0156794433, 0)
239TextLabel10.BackgroundColor3 = Color3.new(1, 1, 1)
240TextLabel10.BackgroundTransparency = 1
241TextLabel10.Font = Enum.Font.SourceSans
242TextLabel10.FontSize = Enum.FontSize.Size48
243TextLabel10.TextColor3 = Color3.new(1, 1, 1)
244Frame11.Name = "LeaveFrame"
245Frame11.Parent = ScreenGui0
246Frame11.Size = UDim2.new(0, 522, 0, 442)
247Frame11.Style = Enum.FrameStyle.RobloxRound
248Frame11.Position = UDim2.new(0.5, -300, 0.5, -250)
249Frame11.Visible = false
250Frame11.BackgroundColor3 = Color3.new(1, 1, 1)
251TextButton12.Name = "Leave"
252TextButton12.Parent = Frame11
253TextButton12.Size = UDim2.new(0, 135, 0, 50)
254TextButton12.Style = Enum.ButtonStyle.RobloxButtonDefault
255TextButton12.Text = "Leave"
256TextButton12.Position = UDim2.new(0.622605324, 0, 0.782805443, 0)
257TextButton12.BackgroundColor3 = Color3.new(1, 1, 1)
258TextButton12.Font = Enum.Font.ArialBold
259TextButton12.FontSize = Enum.FontSize.Size24
260TextButton12.TextColor3 = Color3.new(1, 1, 1)
261TextButton13.Name = "Stay"
262TextButton13.Parent = Frame11
263TextButton13.Size = UDim2.new(0, 131, 0, 46)
264TextButton13.Style = Enum.ButtonStyle.RobloxButtonDefault
265TextButton13.Text = "Stay"
266TextButton13.Position = UDim2.new(0.139846742, 0, 0.782805383, 0)
267TextButton13.BackgroundColor3 = Color3.new(1, 1, 1)
268TextButton13.Font = Enum.Font.ArialBold
269TextButton13.FontSize = Enum.FontSize.Size24
270TextButton13.TextColor3 = Color3.new(1, 1, 1)
271TextLabel14.Name = "LeaveMsg"
272TextLabel14.Parent = Frame11
273TextLabel14.Transparency = 0
274TextLabel14.Size = UDim2.new(0, 514, 0, 50)
275TextLabel14.Text = "Leave this game?"
276TextLabel14.Position = UDim2.new(-0.00383141637, 0, 0.376057446, 0)
277TextLabel14.BackgroundColor3 = Color3.new(1, 1, 1)
278TextLabel14.BackgroundTransparency = 1
279TextLabel14.Font = Enum.Font.Arial
280TextLabel14.FontSize = Enum.FontSize.Size48
281TextLabel14.TextColor3 = Color3.new(1, 1, 1)
282Sound15.Name = "Fart"
283Sound15.Parent = ScreenGui0
284Sound15.SoundId = "rbxassetid://174658105"
285Frame16.Name = "FartFrame"
286Frame16.Parent = ScreenGui0
287Frame16.Size = UDim2.new(0, 522, 0, 468)
288Frame16.Style = Enum.FrameStyle.RobloxRound
289Frame16.Position = UDim2.new(0.5, -300, 0.5, -250)
290Frame16.Visible = false
291Frame16.BackgroundColor3 = Color3.new(1, 1, 1)
292TextLabel17.Name = "LeaveMsg2"
293TextLabel17.Parent = Frame16
294TextLabel17.Transparency = 0
295TextLabel17.Size = UDim2.new(0, 514, 0, 50)
296TextLabel17.Text = "No help 4 u "
297TextLabel17.Position = UDim2.new(-0.00480052829, 0, 0.450323284, 0)
298TextLabel17.BackgroundColor3 = Color3.new(1, 1, 1)
299TextLabel17.BackgroundTransparency = 1
300TextLabel17.Font = Enum.Font.Arial
301TextLabel17.FontSize = Enum.FontSize.Size48
302TextLabel17.TextColor3 = Color3.new(1, 1, 1)
303TextLabel18.Name = "LeaveMsg"
304TextLabel18.Parent = Frame16
305TextLabel18.Transparency = 0
306TextLabel18.Size = UDim2.new(0, 514, 0, 50)
307TextLabel18.Text = "LOL u fart"
308TextLabel18.Position = UDim2.new(-0.00766283507, 0, 0.274247497, 0)
309TextLabel18.BackgroundColor3 = Color3.new(1, 1, 1)
310TextLabel18.BackgroundTransparency = 1
311TextLabel18.Font = Enum.Font.Arial
312TextLabel18.FontSize = Enum.FontSize.Size48
313TextLabel18.TextColor3 = Color3.new(1, 1, 1)
314ImageButton19.Name = "MenuButton"
315ImageButton19.Parent = ScreenGui0
316ImageButton19.Transparency = 1
317ImageButton19.Size = UDim2.new(0, 100, 0, 71)
318ImageButton19.Position = UDim2.new(0, 0, 0.907831252, 0)
319ImageButton19.BackgroundColor3 = Color3.new(1, 1, 1)
320ImageButton19.BackgroundTransparency = 1
321ImageButton19.Image = "rbxassetid://1295761930"
322Frame20.Name = "ReportFrame"
323Frame20.Parent = ScreenGui0
324Frame20.Size = UDim2.new(0, 522, 0, 574)
325Frame20.Style = Enum.FrameStyle.RobloxRound
326Frame20.Position = UDim2.new(0.345186979, 0, 0.128409088, 0)
327Frame20.Visible = false
328Frame20.BackgroundColor3 = Color3.new(1, 1, 1)
329TextLabel21.Parent = Frame20
330TextLabel21.Transparency = 1
331TextLabel21.Size = UDim2.new(0, 200, 0, 50)
332TextLabel21.Text = "Report"
333TextLabel21.Position = UDim2.new(0.298850566, 0, 0.0156794433, 0)
334TextLabel21.BackgroundColor3 = Color3.new(1, 1, 1)
335TextLabel21.BackgroundTransparency = 1
336TextLabel21.Font = Enum.Font.SourceSans
337TextLabel21.FontSize = Enum.FontSize.Size48
338TextLabel21.TextColor3 = Color3.new(1, 1, 1)
339TextBox22.Name = "ReportPlayer"
340TextBox22.Parent = Frame20
341TextBox22.Size = UDim2.new(0, 452, 0, 50)
342TextBox22.Text = "Name Here"
343TextBox22.Position = UDim2.new(0.0517241396, 0, 0.130662024, 0)
344TextBox22.BackgroundColor3 = Color3.new(0, 0, 0)
345TextBox22.BorderColor3 = Color3.new(0.380392, 0.380392, 0.380392)
346TextBox22.Font = Enum.Font.ArialBold
347TextBox22.FontSize = Enum.FontSize.Size32
348TextBox22.TextColor3 = Color3.new(1, 1, 1)
349TextButton23.Name = "ReportSubmit"
350TextButton23.Parent = Frame20
351TextButton23.Size = UDim2.new(0, 359, 0, 50)
352TextButton23.Style = Enum.ButtonStyle.RobloxButtonDefault
353TextButton23.Text = "Submit Report"
354TextButton23.Position = UDim2.new(0.145593867, 0, 0.876306653, 0)
355TextButton23.BackgroundColor3 = Color3.new(1, 1, 1)
356TextButton23.Font = Enum.Font.ArialBold
357TextButton23.FontSize = Enum.FontSize.Size24
358TextButton23.TextColor3 = Color3.new(1, 1, 1)
359Frame24.Name = "TrickedFrame"
360Frame24.Parent = ScreenGui0
361Frame24.Size = UDim2.new(0, 522, 0, 299)
362Frame24.Style = Enum.FrameStyle.RobloxRound
363Frame24.Position = UDim2.new(0.339975476, 0, 0.284102559, 0)
364Frame24.Visible = false
365Frame24.BackgroundColor3 = Color3.new(1, 1, 1)
366TextLabel25.Name = "LeaveMsg"
367TextLabel25.Parent = Frame24
368TextLabel25.Transparency = 0
369TextLabel25.Size = UDim2.new(0, 514, 0, 50)
370TextLabel25.Text = "U got tricked"
371TextLabel25.Position = UDim2.new(-0.00766283507, 0, 0.274247497, 0)
372TextLabel25.BackgroundColor3 = Color3.new(1, 1, 1)
373TextLabel25.BackgroundTransparency = 1
374TextLabel25.Font = Enum.Font.SourceSans
375TextLabel25.FontSize = Enum.FontSize.Size48
376TextLabel25.TextColor3 = Color3.new(1, 1, 1)
377TextLabel26.Name = "LeaveMsg2"
378TextLabel26.Parent = Frame24
379TextLabel26.Transparency = 0
380TextLabel26.Size = UDim2.new(0, 514, 0, 50)
381TextLabel26.Text = "Say hello to the kick hammer >:D"
382TextLabel26.Position = UDim2.new(-0.00480052829, 0, 0.450323284, 0)
383TextLabel26.BackgroundColor3 = Color3.new(1, 1, 1)
384TextLabel26.BackgroundTransparency = 1
385TextLabel26.Font = Enum.Font.SourceSans
386TextLabel26.FontSize = Enum.FontSize.Size36
387TextLabel26.TextColor3 = Color3.new(1, 1, 1)
388Frame27.Name = "ResetFrame"
389Frame27.Parent = ScreenGui0
390Frame27.Size = UDim2.new(0, 566, 0, 442)
391Frame27.Style = Enum.FrameStyle.RobloxRound
392Frame27.Position = UDim2.new(0.5, -300, 0.5, -250)
393Frame27.Visible = false
394Frame27.BackgroundColor3 = Color3.new(1, 1, 1)
395TextLabel28.Name = "LeaveMsg"
396TextLabel28.Parent = Frame27
397TextLabel28.Transparency = 0
398TextLabel28.Size = UDim2.new(0, 514, 0, 50)
399TextLabel28.Text = "Are you sure you want to reset"
400TextLabel28.Position = UDim2.new(0.0192857049, 0, 0.360220343, 0)
401TextLabel28.BackgroundColor3 = Color3.new(1, 1, 1)
402TextLabel28.BackgroundTransparency = 1
403TextLabel28.Font = Enum.Font.SourceSans
404TextLabel28.FontSize = Enum.FontSize.Size48
405TextLabel28.TextColor3 = Color3.new(1, 1, 1)
406TextButton29.Name = "Reset"
407TextButton29.Parent = Frame27
408TextButton29.Size = UDim2.new(0, 135, 0, 50)
409TextButton29.Style = Enum.ButtonStyle.RobloxButtonDefault
410TextButton29.Text = "Reset"
411TextButton29.Position = UDim2.new(0.622605324, 0, 0.782805443, 0)
412TextButton29.BackgroundColor3 = Color3.new(1, 1, 1)
413TextButton29.Font = Enum.Font.ArialBold
414TextButton29.FontSize = Enum.FontSize.Size24
415TextButton29.TextColor3 = Color3.new(1, 1, 1)
416TextButton30.Name = "Cancel"
417TextButton30.Parent = Frame27
418TextButton30.Size = UDim2.new(0, 131, 0, 46)
419TextButton30.Style = Enum.ButtonStyle.RobloxButtonDefault
420TextButton30.Text = "Cancel"
421TextButton30.Position = UDim2.new(0.139846742, 0, 0.782805383, 0)
422TextButton30.BackgroundColor3 = Color3.new(1, 1, 1)
423TextButton30.Font = Enum.Font.ArialBold
424TextButton30.FontSize = Enum.FontSize.Size24
425TextButton30.TextColor3 = Color3.new(1, 1, 1)
426TextLabel31.Name = "LeaveMsg2"
427TextLabel31.Parent = Frame27
428TextLabel31.Transparency = 0
429TextLabel31.Size = UDim2.new(0, 514, 0, 50)
430TextLabel31.Text = "your charcter?"
431TextLabel31.Position = UDim2.new(0.0358355157, 0, 0.457110614, 0)
432TextLabel31.BackgroundColor3 = Color3.new(1, 1, 1)
433TextLabel31.BackgroundTransparency = 1
434TextLabel31.Font = Enum.Font.SourceSans
435TextLabel31.FontSize = Enum.FontSize.Size48
436TextLabel31.TextColor3 = Color3.new(1, 1, 1)
437TextLabel32.Name = "LeaveMsg3"
438TextLabel32.Parent = Frame27
439TextLabel32.Transparency = 0
440TextLabel32.Size = UDim2.new(0, 514, 0, 50)
441TextLabel32.Text = "You will be put back on a spawn point "
442TextLabel32.Position = UDim2.new(0.0358355157, 0, 0.574757636, 0)
443TextLabel32.BackgroundColor3 = Color3.new(1, 1, 1)
444TextLabel32.BackgroundTransparency = 1
445TextLabel32.Font = Enum.Font.SourceSans
446TextLabel32.FontSize = Enum.FontSize.Size24
447TextLabel32.TextColor3 = Color3.new(1, 1, 1)
448ImageButton33.Name = "BackpackButton"
449ImageButton33.Parent = ScreenGui0
450ImageButton33.Transparency = 0
451ImageButton33.Size = UDim2.new(0, 184, 0, 28)
452ImageButton33.Position = UDim2.new(0.266579986, 0, 0.969230771, 0)
453ImageButton33.BackgroundColor3 = Color3.new(1, 1, 1)
454ImageButton33.BackgroundTransparency = 1
455ImageButton33.Image = "rbxassetid://1552525769"
456for i,v in pairs(mas:GetChildren()) do
457 v.Parent = game:GetService("Players").LocalPlayer.PlayerGui
458 pcall(function() v:MakeJoints() end)
459end
460mas:Destroy()
461for i,v in pairs(cors) do
462 spawn(function()
463 pcall(v)
464 end)
465end
466
467
468--Converted with ttyyuu12345's model to script plugin v4
469function sandbox(var,func)
470 local env = getfenv(func)
471 local newenv = setmetatable({},{
472 __index = function(self,k)
473 if k=="script" then
474 return var
475 else
476 return env[k]
477 end
478 end,
479 })
480 setfenv(func,newenv)
481 return func
482end
483cors = {}
484mas = Instance.new("Model",game:GetService("Lighting"))
485ScreenGui0 = Instance.new("ScreenGui")
486LocalScript1 = Instance.new("LocalScript")
487ScreenGui0.Name = "CustomPlayerList"
488ScreenGui0.Parent = mas
489LocalScript1.Name = "New PlayerListScript"
490LocalScript1.Parent = ScreenGui0
491table.insert(cors,sandbox(LocalScript1,function()
492game:GetService("StarterGui"):SetCoreGuiEnabled("PlayerList", false) -- Ctrl+F "API DOCS" to get the docs
493
494--settings. Don't make these local.
495ALLOW_BC_ICONS = true -- Players' BC icons will be shown next to their names
496PRIMARY_LEADERSTATS_ENABLED = true -- Leaderstats will appear in large text under the player's name
497SHOW_PRIMARY_LEADERSTAT_NAMES = true -- Primary leaderstats will have their names shown next to them
498TEAMS_ENABLED = true -- Teams will appear.
499
500CUSTOM_CHAT_COLORS = { -- add your name = Color3 to give yourself a custom chat color.
501 -- if you don't choose a chat color, but you do add a custom icon, your color will appear as golden
502 -- if you don't want golden but you do want an icon, you can set your chat color to Color3.new(1,1,1)
503 JOHNTHEBOOTYSLAMMER = Color3.new(5, 0, 0)
504}
505
506HIDDEN_PLAYERS = { -- add playerName=true to prevent them from appearing on the leaderboard
507 example_player_name = faldr
508}
509
510CUSTOM_LABEL_BACKGROUND_COLORS = { -- add playerName=color3 to give certain players a unique backgroundColor
511 shrek = Color3.new(1, 0, 0)
512}
513
514CUSTOM_LABEL_NAME_COLORS = { -- add playerName=color3 to give certain players a uniquely-colored name
515 SkySpell = Color3.new(0, 0, 0)
516}
517
518ADMINS =
519{ -- add your name = 1 to get a star icon. Add your name = image to get a custom icon.
520 arceusinator = "http://www.roblox.com/asset?id=150832060",
521 player1 = 1,
522 aceswayuphigh = 1,
523 adamintygum = 1,
524 afackler11 = 1,
525 aleverns = 1,
526 aquabot8 = 1,
527 arbolito = 1,
528 argforpirates = 1,
529 argonpirate = 1,
530 asmohdian = 1,
531 bellavour = 1,
532 blockhaak = 1,
533 brighteyes = 1,
534 briguy9876 = 1,
535 builderman = 1,
536 cdakkar = 1,
537 chiefjustus = 1,
538 chro = 1,
539 cmed = 1,
540 coatp0cketninja = 1,
541 codewriter = 1,
542 commandercrow = 1,
543 corgiparade = 1,
544 dapperbuffalo = 1,
545 dbapostle = 1,
546 deeana00 = 1,
547 doughtless = 1,
548 dunbar1138 = 1,
549 echodown = 1,
550 ffjosh = 1,
551 foyle = 1,
552 fusroblox = 'http://www.roblox.com/asset/?id=99852703',
553 gemlocker = 1,
554 goddessnoob = 1,
555 gongfutiger = 1,
556 gordonrox24 = 1,
557 gorroth = 1,
558 grossinger = 1,
559 groundcontroll2 = 1,
560 hawkeyebandit = 1,
561 hawkington = 1,
562 ibanez2189 = 1,
563 iltalumi = 1,
564 inventx = 1,
565 jeditkacheff = 1,
566 kbux = 1,
567 keith = 1,
568 limon = 1,
569 loopylens = 1,
570 lordrugdumph = 1,
571 majortom4321 = 1,
572 malcomso = 1,
573 maxvee = 1,
574 midwinterfires = 1,
575 mistersquirrel = 1,
576 morganic = 1,
577 motornerve = 1,
578 mrdoombringer = 1,
579 mse6 = 1,
580 newtrat = 1,
581 niquemonster = 1,
582 nobledragon = 1,
583 noob007 = 1,
584 nrawat1 = 1,
585 olive71 = 1,
586 onlytwentycharacters = 1,
587 orcasparkles = 1,
588 ostrichsized = 1,
589 phaedre = 1,
590 phil = 1,
591 pulmoesflor = 1,
592 raeglyn = 1,
593 rbadam = 1,
594 reesemcblox = 1,
595 robliu = 1,
596 roblowilson = 1,
597 robloxsai = 1,
598 roboyz = 1,
599 saurauss = 1,
600 screenme = 1,
601 scubasomething = 1,
602 seanthornton = 1,
603 shedletsky = 'http://www.roblox.com/asset/?id=105897927',
604 sickenedmonkey = 1,
605 SkySpell = 'http://www.roblox.com/asset/?id=159549316',
606 slingshotjunkie = 1,
607 smeaferblox = 1,
608 soggoth = 1,
609 solarcrane = 1,
610 sooraya = 1,
611 sorcus = 'http://www.roblox.com/asset/?id=113059239',
612 squidcod = 1,
613 stickmasterluke = 1,
614 stuball = 1,
615 tabemono = 1,
616 tarabyte = 1,
617 thelorekt = 1,
618 thorasaur = 1,
619 timobius = 1,
620 tobotrobot = 1,
621 tone = 1,
622 totallynothere = 1,
623 totbl = 1,
624 twberg = 1,
625 vaiobot = 1,
626 varia = 1,
627 vladthefirst = 1,
628 wonderboy76 = 1,
629 xerolayne = 1,
630 yesth = 1,
631 yumyumcheerios = 1,
632 hacker7106 = 1,
633 zodiaczak = 1,
634 ['erik.cassel'] = 1,
635 ['david.baszucki'] = 1,
636 ['matt dusek'] = 1,
637}
638
639ADMIN_ICON_WIDTHS = {
640 SkySpell = 30
641}
642
643ALIASES = {
644 player1 = "PLAYER X",
645 hacker7106 = "7 Grand Dad"
646}
647
648-- API DOCS
649-- _G.PlayerListAPI:SetAllowBCIcons(true or false)
650-- :AddAdmin(String name, Optional Content customIcon, Optional Int customIconWidth)
651-- :RemoveAdmin(String name)
652-- :SetAlias(String name, String alias)
653-- :SetPlayerIsHidden(String name)
654-- :SetLabelColors(String playerName, Color3 backgroundColor, Color3 textColor)
655-- _G.ChatAPI:SendChat(String playername, String message, Color3 customcolor)
656
657for name,a in pairs(ADMINS) do
658 ADMINS[name:lower()] = a
659end
660for name,a in pairs(CUSTOM_CHAT_COLORS) do
661 CUSTOM_CHAT_COLORS[name:lower()] = a
662end
663for name,a in pairs(ALIASES) do
664 ALIASES[name:lower()] = a
665end
666for name,a in pairs(HIDDEN_PLAYERS) do
667 HIDDEN_PLAYERS[name:lower()] = a
668end
669for name,a in pairs(CUSTOM_LABEL_BACKGROUND_COLORS) do
670 CUSTOM_LABEL_BACKGROUND_COLORS[name:lower()] = a
671end
672for name,a in pairs(CUSTOM_LABEL_NAME_COLORS) do
673 CUSTOM_LABEL_NAME_COLORS[name:lower()] = a
674end
675
676function GetAliasOf(name)
677 return ALIASES[name:lower()] or name
678end
679
680local export = {}
681
682export.SetAllowBCIcons = function(self, b)
683 ALLOW_BC_ICONS = b
684end
685
686export.AddAdmin = function(self, name, customicon, customiconwidth)
687 ADMINS[name:lower()] = customicon or 1
688 ADMIN_ICON_WIDTHS[name:lower()] = customiconwidth or 16
689end
690
691export.RemoveAdmin = function(self, name)
692 ADMINS[name:lower()] = 0
693end
694
695export.GetChatData = function(self)
696 return ADMINS, CUSTOM_CHAT_COLORS, ALIASES
697end
698
699export.SetAlias = function(self, name, alias)
700 if alias == "" or alias == nil then
701 ALIASES[name:lower()] = name
702 else
703 ALIASES[name:lower()] = alias
704 end
705end
706
707export.GetAlias = function(self, name)
708 return GetAliasOf(name)
709end
710
711export.SetLabelColors = function(self, playerName, backgroundColor, textColor)
712 CUSTOM_LABEL_BACKGROUND_COLORS[playerName:lower()] = backgroundColor
713 CUSTOM_LABEL_NAME_COLORS[playerName:lower()] = textColor
714end
715
716export.SetPlayerIsHidden = function(self, name, bool)
717 local current = not not HIDDEN_PLAYERS[name:lower()]
718 local new = not not bool
719 local changing = current ~= new
720
721 HIDDEN_PLAYERS[name:lower()] = new
722
723 if changing then
724 if new then
725 local existingPlayer = nil
726
727 for index, player in next, game.Players:GetPlayers() do
728 if player.Name:lower() == name:lower() then
729 existingPlayer = player
730 break
731 end
732 end
733
734
735 if existingPlayer ~= nil then
736 InsertPlayerFrame(existingPlayer)
737 end
738 elseif not new then
739 local existingPlayer = nil
740
741 for index, player in next, game.Players:GetPlayers() do
742 if player.Name:lower() == name:lower() then
743 existingPlayer = player
744 break
745 end
746 end
747
748
749 if existingPlayer ~= nil then
750 RemovePlayerFrame(existingPlayer)
751 end
752 end
753 end
754end
755
756_G.PlayerListAPI = export
757
758local Images = {
759 bottomDark = '94691904',
760 bottomLight = '94691940',
761 midDark = '94691980',
762 midLight = '94692025',
763 LargeDark = '96098866',
764 LargeLight = '96098920',
765 LargeHeader = '96097470',
766 NormalHeader = '94692054',
767 LargeBottom = '96397271',
768 NormalBottom = '94754966',
769 DarkBluePopupMid = '97114905',
770 LightBluePopupMid = '97114905',
771 DarkPopupMid = '97112126',
772 LightPopupMid = '97109338',
773 DarkBluePopupTop = '97114838',
774 DarkBluePopupBottom = '97114758',
775 DarkPopupBottom = '100869219',
776 LightPopupBottom = '97109175',
777}
778
779local BASE_TWEEN = .25
780
781local MOUSE_HOLD_TIME = .15
782local MOUSE_DRAG_DISTANCE = 15
783
784--[[
785 Generic object Create function, which I am using to create Gui's
786 Thanks to Stravant!
787--]]
788local Obj = {}
789function Obj.Create(guiType)
790 return function(data)
791 local obj = Instance.new(guiType)
792 for k, v in pairs(data) do
793 if type(k) == 'number' then
794 v.Parent = obj
795 else
796 obj[k] = v
797 end
798 end
799 return obj
800 end
801end
802
803--[[
804 makes a full sized background for a guiobject
805 @Args:
806 imgName asset name of image to fill background
807 @Return: background gui object
808--]]
809function MakeBackgroundGuiObj(imgName)
810 return Obj.Create'ImageLabel'
811 {
812 Name = 'Background',
813 BackgroundTransparency = 1,
814 Image = imgName,
815 Position = UDim2.new(0, 0, 0, 0),
816 Size = UDim2.new(1,0,1,0),
817 }
818end
819--[[ turns 255 integer color value to a color3 --]]
820function Color3I(r,g,b)
821 return Color3.new(r/255,g/255,b/255)
822end
823
824--[[
825 Gets correct icon for builder's club status to display by name
826 @Args:
827 membershipType Enum of membership status
828 @Return: string of image asset
829--]]
830function getMembershipTypeIcon(membershipType,playerName)
831 if ADMINS[string.lower(playerName)]~=nil then
832 if ADMINS[string.lower(playerName)] == 1 then
833 return "http://www.roblox.com/asset/?id=99727663"
834 else
835 local dat = ADMINS[string.lower(playerName)]
836
837 if type(dat) == "table" then
838 return dat[1]
839 elseif type(dat) == "string" then
840 return ADMINS[string.lower(playerName)]
841 else
842 return "http://www.roblox.com/asset/?id=99727663"
843 end
844 end
845 elseif membershipType == Enum.MembershipType.None then
846 return ""
847 elseif membershipType == Enum.MembershipType.BuildersClub then
848 return "rbxasset://textures/ui/TinyBcIcon.png"
849 elseif membershipType == Enum.MembershipType.TurboBuildersClub then
850 return "rbxasset://textures/ui/TinyTbcIcon.png"
851 elseif membershipType == Enum.MembershipType.OutrageousBuildersClub then
852 return "rbxasset://textures/ui/TinyObcIcon.png"
853 else
854 error("Unknown membershipType" .. membershipType)
855 end
856end
857
858local function getFriendStatusIcon(friendStatus)
859 if friendStatus == Enum.FriendStatus.Unknown or friendStatus == Enum.FriendStatus.NotFriend then
860 return ""
861 elseif friendStatus == Enum.FriendStatus.Friend then
862 return "http://www.roblox.com/asset/?id=99749771"
863 elseif friendStatus == Enum.FriendStatus.FriendRequestSent then
864 return "http://www.roblox.com/asset/?id=99776888"
865 elseif friendStatus == Enum.FriendStatus.FriendRequestReceived then
866 return "http://www.roblox.com/asset/?id=99776838"
867 else
868 error("Unknown FriendStatus: " .. friendStatus)
869 end
870end
871
872
873--[[
874 Utility function to create buttons for the popup menus
875 @Args:
876 nparent what to parent this button to
877 ntext text to put on this button
878 index number index of this entry in menu
879 last is this the last element of the popup menu
880 @Return: a popup menu button
881--]]
882function MakePopupButton(nparent,ntext,index,last)
883 local tobj = Obj.Create"ImageButton"
884 {
885 Name = 'ReportButton',
886 BackgroundTransparency = 1,
887 Position = UDim2.new(0,0,1*index,0),
888 Size = UDim2.new(1, 0, 1, 0),
889 ZIndex=7,
890 Obj.Create'TextLabel'
891 {
892 Name = 'ButtonText',
893 BackgroundTransparency = 1,
894 Position = UDim2.new(.07, 0, .07, 0),
895 Size = UDim2.new(.86,0,.86,0),
896 Parent = HeaderFrame,
897 Font = 'ArialBold',
898 Text = ntext,
899 FontSize = 'Size14',
900 TextScaled = true,
901 TextColor3 = Color3.new(1,1,1),
902 TextStrokeTransparency = 1,
903 ZIndex=7,
904 },
905 Parent = nparent,
906 }
907 if index==0 then
908 tobj.Image = 'http://www.roblox.com/asset/?id=97108784'
909 elseif last then
910 if index%2==1 then
911 tobj.Image = 'http://www.roblox.com/asset/?id='.. Images['LightPopupBottom']
912 else
913 tobj.Image = 'http://www.roblox.com/asset/?id='.. Images['DarkPopupBottom']
914 end
915 else
916 if index%2==1 then
917 tobj.Image = 'http://www.roblox.com/asset/?id=97112126'
918 else
919 tobj.Image = 'http://www.roblox.com/asset/?id=97109338'
920 end
921 end
922 return tobj
923end
924
925
926--[[
927 obligatory wait for child function
928 @Args:
929 parent Parent object to look for child in
930 child name of child object to look for
931 @Return: object waited for
932--]]
933function WaitForChild(parent,child)
934 while not parent:FindFirstChild(child) do
935 wait() debugprint(" child "..parent.Name.." waiting for "..child)
936 end
937 return parent[child]
938end
939
940 ---------------------------
941 -- Workspace Objects
942 ---------------------------
943
944-- might want to move all this to an init function, wait for localplayer elsewhere
945local Players = game:GetService('Players')
946-- make sure this doesn't run on the server(it will if you dont do this)
947while not Players.LocalPlayer do
948 Players.Changed:wait()
949end
950
951local LocalPlayer = Players.LocalPlayer
952local Mouse = LocalPlayer:GetMouse()
953
954local ScreenGui = Obj.Create"Frame"
955{
956 Name = 'PlayerListScreen',
957 Size = UDim2.new(1, 0, 1, 0),
958 BackgroundTransparency = 1,
959 Parent = script.Parent
960}
961local MainFrame = Obj.Create"Frame"
962{
963 Name = 'LeaderBoardFrame',
964 Position = UDim2.new(1, -150, 0.005, 0),
965 Size = UDim2.new(0, 150, 0, 800),
966 BackgroundTransparency = 1,
967 Parent = ScreenGui,
968}
969
970--frame used for expanding leaderstats when frame is 'focused'
971local FocusFrame = Obj.Create"Frame"
972{
973 Name = 'FocusFrame',
974 Position = UDim2.new(0, 0, 0, 0),
975 Size = UDim2.new(1, 0, 0, 100),
976 BackgroundTransparency = 1,
977 Active = true,
978 Parent = MainFrame,
979}
980
981local TemplateFrameYSize = 0.670000017
982
983 -- HEADER
984local HeaderFrame = Obj.Create"Frame"
985{
986 Name = 'Header',
987 BackgroundTransparency = 1,
988 Position = UDim2.new(0,0,0,0),
989 Size = UDim2.new(1, 0, .07, 0),
990 Parent = MainFrame,
991 MakeBackgroundGuiObj('http://www.roblox.com/asset/?id=94692054'),
992}
993 local HeaderFrameHeight = HeaderFrame.Size.Y.Scale
994 local MaximizeButton = Obj.Create"ImageButton"
995 {
996 Name = 'MaximizeButton',
997 Active = true,
998 BackgroundTransparency = 1,
999 Position = UDim2.new(0, 0, 0, 0),
1000 Size = UDim2.new(1,0,1,0),
1001 Parent = HeaderFrame,
1002 }
1003 local HeaderName = Obj.Create"TextLabel"
1004 {
1005 Name = 'PlayerName',
1006 BackgroundTransparency = 1,
1007 Position = UDim2.new(0, 0, .01, 0),
1008 Size = UDim2.new(.98,0,.38,0),
1009 Parent = HeaderFrame,
1010 Font = 'ArialBold',
1011 Text = GetAliasOf(LocalPlayer.Name),
1012 FontSize='Size24',
1013 --TextScaled = true,
1014 TextColor3 = Color3.new(1,1,1),
1015 TextStrokeColor3 = Color3.new(0,0,0),
1016 TextStrokeTransparency = 0,
1017 TextXAlignment = 'Right',
1018 TextYAlignment = 'Center',
1019 }
1020 local HeaderScore = Obj.Create"TextLabel"
1021 {
1022 Name = 'PlayerScore',
1023 BackgroundTransparency = 1,
1024 Position = UDim2.new(0, 0, .4, 0),
1025 Size = UDim2.new(.98,0,0,30),
1026 Parent = HeaderFrame,
1027 Font = 'ArialBold',
1028 Text = '',
1029 FontSize='Size24',
1030 TextYAlignment = 'Top',
1031 --TextScaled = true,
1032 TextColor3 = Color3.new(1,1,1),
1033 TextStrokeTransparency = 1,
1034 TextXAlignment = 'Right',
1035 TextYAlignment = 'Top',
1036 }
1037 local HeaderScoreName = Obj.Create"TextLabel"
1038 {
1039 Name = 'ScoreNameLabel',
1040 BackgroundTransparency = 1,
1041 Position = UDim2.new(0, 5, 0, 0),
1042 Size = UDim2.new(1, 0, 1, 0),
1043 Font = 'ArialBold',
1044 FontSize = 'Size14',
1045 Text = '',
1046 TextColor3 = Color3.new(1, 1, 1),
1047 TextStrokeTransparency = 0,
1048 TextXAlignment = 'Left',
1049 Parent = HeaderScore
1050 }
1051
1052coroutine.resume(coroutine.create(function() while wait(1) do
1053 HeaderFrame.PlayerName.Text = GetAliasOf(LocalPlayer.Name)
1054end end))
1055 -- BOTTOM
1056 --used for shifting bottom frame for mouse over effects
1057local BottomShiftFrame = Obj.Create"Frame"
1058{
1059 Name= 'BottomShiftFrame',
1060 BackgroundTransparency = 1,
1061 Position = UDim2.new(0,0,HeaderFrameHeight,0),
1062 Size = UDim2.new(1,0,1,0),
1063 Parent=MainFrame,
1064}
1065 local BottomFrame = Obj.Create"Frame"
1066 {
1067 Name = 'Bottom',
1068 BackgroundTransparency = 1,
1069 Position = UDim2.new(0,0,.07,0),
1070 Size = UDim2.new(1, 0, .03, 0),
1071 Parent = BottomShiftFrame,
1072 MakeBackgroundGuiObj('http://www.roblox.com/asset/?id=94754966'),
1073 }
1074 local ExtendButton = Obj.Create"ImageButton"
1075 {
1076 Name = 'bigbutton',
1077 Active = true,
1078 BackgroundTransparency = 1,
1079 Position = UDim2.new(0, 0, 0, 0),
1080 Size = UDim2.new(1,0,1.5,0),
1081 ZIndex = 3,
1082 Parent = BottomFrame,
1083 }
1084 local ExtendTab = Obj.Create"ImageButton"
1085 {
1086 Name = 'extendTab',
1087 Active = true,
1088 BackgroundTransparency = 1,
1089 Image = 'http://www.roblox.com/asset/?id=94692731',
1090 Position = UDim2.new(.608, 0, .3, 0),
1091 Size = UDim2.new(.3,0,.7,0),
1092 Parent = BottomFrame,
1093 }
1094local TopClipFrame = Obj.Create"Frame"
1095{
1096 Name = 'ListFrame',
1097 BackgroundTransparency = 1,
1098 Position = UDim2.new(-1,0,.07,0),
1099 Size = UDim2.new(2, 0, 1, 0),
1100 Parent = MainFrame,
1101 ClipsDescendants = true,
1102}
1103 local BottomClipFrame = Obj.Create"Frame"
1104 {
1105 Name = 'BottomFrame',
1106 BackgroundTransparency = 1,
1107 Position = UDim2.new(0,0, - .8,0),
1108 Size = UDim2.new(1, 0, 1, 0),
1109 Parent = TopClipFrame,
1110 ClipsDescendants = true,
1111 }
1112 local ScrollBarFrame = Obj.Create"Frame"
1113 {
1114 Name = 'ScrollBarFrame',
1115 BackgroundTransparency = 1,
1116 Position = UDim2.new(.987,0,.8,0),
1117 Size = UDim2.new(.01, 0, .2, 0),
1118 Parent = BottomClipFrame,
1119 }
1120 local ScrollBar = Obj.Create"Frame"
1121 {
1122 Name = 'ScrollBar',
1123 BackgroundTransparency = 0,
1124 BackgroundColor3 = Color3.new(.2,.2,.2),
1125 Position = UDim2.new(0,0,0,0),
1126 Size = UDim2.new(1, 0, .5, 0),
1127 ZIndex = 5,
1128 Parent = ScrollBarFrame,
1129
1130 }
1131 local ListFrame = Obj.Create"Frame"
1132 {
1133 Name = 'SubFrame',
1134 BackgroundTransparency = 1,
1135 Position = UDim2.new(0,0,.8,0),
1136 Size = UDim2.new(1, 0, 1, 0),
1137 Parent = BottomClipFrame,
1138 }
1139local PopUpClipFrame = Obj.Create"Frame"
1140{
1141 Name = 'PopUpFrame',
1142 BackgroundTransparency = 1,
1143 SizeConstraint='RelativeXX',
1144 Position = MainFrame.Position + UDim2.new( 0,-150,0,0),
1145 Size = UDim2.new(0,150,0,800),
1146 Parent = MainFrame,
1147 ClipsDescendants = true,
1148 ZIndex=7,
1149}
1150local PopUpPanel = nil
1151 local PopUpPanelTemplate = Obj.Create"Frame"
1152 {
1153 Name = 'Panel',
1154 BackgroundTransparency = 1,
1155 Position = UDim2.new(1,0,0,0),
1156 Size = UDim2.new(1,0,.032,0),
1157 Parent = PopUpClipFrame,
1158 }
1159
1160local StatTitles = Obj.Create"Frame"
1161{
1162 Name = 'StatTitles',
1163 BackgroundTransparency = 1,
1164 Position = UDim2.new(0,0,1,-10),
1165 Size = UDim2.new(1, 0, 0, 0),
1166 Parent = HeaderFrame,
1167}
1168
1169local IsMinimized = Instance.new('BoolValue')
1170local IsMaximized = Instance.new('BoolValue')
1171local IsTabified = Instance.new('BoolValue')
1172local AreNamesExpanded = Instance.new('BoolValue')
1173
1174
1175local MiddleTemplate = Obj.Create"Frame"
1176{
1177 Name = 'MidTemplate',
1178 BackgroundTransparency = 1,
1179 Position = UDim2.new(100,0,.07,0),
1180 Size = UDim2.new(.5, 0, .025, 0),--UDim2.new(1, 0, .03, 0),
1181 Obj.Create'ImageLabel'
1182 {
1183 Name = 'BCLabel',
1184 Active = true,
1185 BackgroundTransparency = 1,
1186 Position = UDim2.new(.005, 3, .20, -2),
1187 Size = UDim2.new(0,16,0,16),
1188 SizeConstraint = 'RelativeYY',
1189 Image = "",
1190 ZIndex = 3,
1191 },
1192 Obj.Create'ImageLabel'
1193 {
1194 Name = 'FriendLabel',
1195 Active = true,
1196 BackgroundTransparency = 1,
1197 Position = UDim2.new(.005, 5, .15, 0),
1198 Size = UDim2.new(0,16,0,16),
1199 SizeConstraint = 'RelativeYY',
1200 Image = "",
1201 ZIndex = 3,
1202 },
1203 Obj.Create"ImageButton"
1204 {
1205 Name = 'ClickListener',
1206 Active = true,
1207 BackgroundTransparency = 1,
1208 Position = UDim2.new(.005, 1, 0, 0),
1209 Size = UDim2.new(.96,0,1,0),
1210 ZIndex = 3,
1211 },
1212 Obj.Create"Frame"
1213 {
1214 Name = 'TitleFrame',
1215 BackgroundTransparency = 1,
1216 Position = UDim2.new(.01, 0, 0, 0),
1217 Size = UDim2.new(0,140,1,0),
1218 ClipsDescendants=true,
1219 Obj.Create"TextLabel"
1220 {
1221 Name = 'Title',
1222 BackgroundTransparency = 1,
1223 Position = UDim2.new(0, 5, 0, 0),
1224 Size = UDim2.new(100,0,1,0),
1225 Font = 'Arial',
1226 FontSize='Size14',
1227 TextColor3 = Color3.new(1,1,1),
1228 TextXAlignment = 'Left',
1229 TextYAlignment = 'Center',
1230 ZIndex = 3,
1231 },
1232 },
1233
1234 Obj.Create"TextLabel"
1235 {
1236 Name = 'PlayerScore',
1237 BackgroundTransparency = 1,
1238 Position = UDim2.new(0, 0, 0, 0),
1239 Size = UDim2.new(1,0,1,0),
1240 Font = 'ArialBold',
1241 Text = '',
1242 FontSize='Size14',
1243 TextColor3 = Color3.new(1,1,1),
1244 TextXAlignment = 'Right',
1245 TextYAlignment = 'Center',
1246 ZIndex = 3,
1247 },
1248 --Obj.Create'IntValue'{Name = 'ID'},
1249 --Obj.Create'ObjectValue'{Name = 'Player'},
1250 --Obj.Create'IntValue'{Name = 'Score'},
1251 ZIndex = 3,
1252}
1253local MiddleBGTemplate = Obj.Create"Frame"
1254{
1255 Name = 'MidBGTemplate',
1256 BackgroundTransparency = 1,
1257 BorderSizePixel = 0,
1258 Position = UDim2.new(100,0,.07,0),
1259 Size = UDim2.new(.5, 0, .025, 0),--UDim2.new(1, 0, .03, 0),
1260 MakeBackgroundGuiObj('http://www.roblox.com/asset/?id=94692025'),
1261
1262}
1263
1264 -- REPORT ABUSE OBJECTS
1265
1266local ReportAbuseShield = Obj.Create"TextButton"
1267{
1268 Name = "ReportAbuseShield",
1269 Text = "",
1270 AutoButtonColor = false,
1271 Active = true,
1272 Visible = true,
1273 Size = UDim2.new(1,0,1,0),
1274 BackgroundColor3 = Color3I(51,51,51),
1275 BorderColor3 = Color3I(27,42,53),
1276 BackgroundTransparency = 1,
1277}
1278
1279local ReportAbuseFrame = Obj.Create "Frame"
1280{
1281 Name = "ReportAbuseFrame",
1282 Position = UDim2.new(0.5, -250, 0.5, -100),
1283 Size = UDim2.new(0, 500, 0, 200),
1284 ZIndex = 9,
1285 Parent = ReportAbuseShield,
1286 Style = "RobloxRound"
1287}
1288
1289local ReportAbuseClose = Obj.Create "TextButton"
1290{
1291 BackgroundColor3 = Color3.new(150/255, 0, 0),
1292 BorderColor3 = Color3.new(200/255, 200/255, 200/255),
1293 Name = "Close",
1294 Position = UDim2.new(1, -20, 0, 0),
1295 Size = UDim2.new(0, 20, 0, 20),
1296 ZIndex = 10,
1297 Font = "SourceSansBold",
1298 FontSize = "Size12",
1299 Text = "X",
1300 TextColor3 = Color3.new(200/255, 200/255, 200/255),
1301 TextStrokeTransparency = 0,
1302 Parent = ReportAbuseFrame
1303}
1304
1305local ReportAbuseHeader = Obj.Create "TextLabel"
1306{
1307 BackgroundTransparency = 1,
1308 Name = "Sorry",
1309 Position = UDim2.new(0.5, 0, 0, 20),
1310 ZIndex = 10,
1311 Font = "ArialBold",
1312 FontSize = "Size36",
1313 Text = "Sorry! :(",
1314 TextColor3 = Color3.new(200/255, 200/255, 200/255),
1315 TextStrokeTransparency = 0,
1316 Parent = ReportAbuseFrame
1317}
1318
1319local ReportAbuseInfo = Obj.Create "TextLabel"
1320{
1321 BackgroundColor3 = Color3.new(),
1322 BackgroundTransparency = 0.5,
1323 BorderColor3 = Color3.new(200/255, 200/255, 200/255),
1324 Name = "ReportAbuseInfo",
1325 Position = UDim2.new(0, 0, 0, 50),
1326 Size = UDim2.new(1, 0, 1, -50),
1327 Font = "ArialBold",
1328 FontSize = "Size14",
1329 Text = "This game is using a specialized player list that uses an API to unlock certain features. Because this is a modified player list, certain high-level functions are disabled such as in-game Friend Requests and the Report Abuse function.",
1330 TextColor3 = Color3.new(200/255, 200/255, 200/255),
1331 TextStrokeTransparency = 0,
1332 TextYAlignment = "Top",
1333 ZIndex = 10,
1334 TextWrapped = true,
1335 Parent = ReportAbuseFrame,
1336 Obj.Create"TextLabel"
1337 {
1338 BackgroundTransparency = 1,
1339 Name = "FRs",
1340 Position = UDim2.new(0, 20, 0, 50),
1341 Size = UDim2.new(1, -40, 1, -50),
1342 ZIndex = 10,
1343 Font = "Arial",
1344 FontSize = "Size12",
1345 Text = "To add a friend, you will need to go to the roblox site and find them using the player search page. Once you've found them, click the \"Add Friend\" button under their character.",
1346 TextColor3 = Color3.new(200/255, 200/255, 200/255),
1347 TextStrokeTransparency = 0,
1348 TextWrapped = true,
1349 TextYAlignment = "Top"
1350 },
1351 Obj.Create"TextLabel"
1352 {
1353 BackgroundTransparency = 1,
1354 Name = "Report",
1355 Position = UDim2.new(0, 20, 0, 90),
1356 Size = UDim2.new(1, -40, 1, -50),
1357 ZIndex = 10,
1358 Font = "Arial",
1359 FontSize = "Size12",
1360 Text = "To report abuse, you need to open your game menu by pressing the 'Esc' button on your keyboard, then click Report Abuse and fill out the necessary information.",
1361 TextColor3 = Color3.new(200/255, 200/255, 200/255),
1362 TextStrokeTransparency = 0,
1363 TextWrapped = true,
1364 TextYAlignment = "Top"
1365 }
1366}
1367
1368local BigButton=Instance.new('ImageButton')
1369 BigButton.Size=UDim2.new(1,0,1,0)
1370 BigButton.BackgroundTransparency=1
1371 BigButton.ZIndex=8
1372 BigButton.Visible=false
1373 --BigButton.Active=false
1374 BigButton.Parent=ScreenGui
1375
1376
1377 local debugFrame = Obj.Create"Frame"
1378 {
1379 Name = 'debugframe',
1380 Position = UDim2.new(0, 0, 0, 0),
1381 Size = UDim2.new(0, 150, 0, 800),--0.99000001
1382 BackgroundTransparency = 1,
1383
1384 }
1385 local debugplayers = Obj.Create"TextLabel"
1386 {
1387 BackgroundTransparency = .8,
1388 Position = UDim2.new(0, 0, .01, 0),
1389 Size = UDim2.new(1,0,.5,0),
1390 Parent = debugFrame,
1391 Font = 'ArialBold',
1392 Text = '--',
1393 FontSize='Size14',
1394 TextWrapped=true,
1395 TextColor3 = Color3.new(1,1,1),
1396 TextStrokeColor3 = Color3.new(0,0,0),
1397 TextStrokeTransparency = 0,
1398 TextXAlignment = 'Right',
1399 TextYAlignment = 'Center',
1400 }
1401 local debugOutput = Obj.Create"TextLabel"
1402 {
1403 BackgroundTransparency = .8,
1404 Position = UDim2.new(0, 0, .5, 0),
1405 Size = UDim2.new(1,0,.5,0),
1406 Parent = debugFrame,
1407 Font = 'ArialBold',
1408 Text = '--',
1409 FontSize='Size14',
1410 TextWrapped=true,
1411 TextColor3 = Color3.new(1,1,1),
1412 TextStrokeColor3 = Color3.new(0,0,0),
1413 TextStrokeTransparency = 0,
1414 TextXAlignment = 'Right',
1415 TextYAlignment = 'Center',
1416 }
1417
1418
1419--[[
1420 simple function to toggle the display of debug output
1421--]]
1422local DebugPrintEnabled=true
1423function debugprint(str)
1424 --print(str)
1425 if DebugPrintEnabled then
1426 debugOutput.Text=str
1427 end
1428end
1429
1430
1431 -------------------------
1432 -- Script objects
1433 -------------------------
1434local RbxGui = assert(LoadLibrary('RbxGui'))
1435
1436 -- number of entries to show if you click minimize
1437local DefaultEntriesOnScreen = 8
1438
1439
1440
1441
1442
1443for _,i in pairs(Images) do
1444 Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..i)
1445end
1446
1447 -- ordered array of 'score data', each entry has:
1448 -- Name(String)
1449 -- Priority(number)
1450 -- IsPrimary (bool, should it be shown in upper right)
1451 -- MaxLength (integer, of the length of the longest element for this column)
1452local ScoreNames = {}
1453 -- prevents flipping in playerlist panels
1454local AddId = 0
1455 -- intermediate table form of all player entries in format of:
1456 -- Frame
1457 -- Player
1458 -- Score
1459 -- ID
1460 -- MyTeam (team ENRTY(not actual team) I am currently on)
1461local PlayerFrames = {}
1462 -- intermediate ordered frame array, composed of Entrys of
1463 -- Frame
1464 -- MyTeam (my team object)
1465 -- MyPlayers ( an ordered array of all player frames in team )
1466 -- AutoHide (bool saying whether it should be hidden)
1467 -- IsHidden (bool)
1468 -- ID (int to prevent flipping out of leaderboard, fun times)
1469local TeamFrames = {}
1470 -- one special entry from teamFrames, for unaffiliated players, only shown if players non - empty
1471local NeutralTeam = nil
1472
1473 -- final 'to be displayed' list of frames
1474local MiddleFrames = {}
1475local MiddleFrameBackgrounds = {}
1476local MiddleFrameHeight = .03
1477 -- time of last click
1478local LastClick = 0
1479local ButtonCooldown = .25
1480
1481local OnIos = false
1482pcall(function() OnIos = Game:GetService('UserInputService').TouchEnabled end)
1483
1484
1485 -- you get 200 of x screen space per stat added, start width 16%
1486local BaseScreenXSize = 150
1487local SpacingPerStat = 10 --spacing between stats
1488
1489
1490local MaximizedBounds = UDim2.new(.5,0,1,0)
1491local MaximizedPosition = UDim2.new(.25,0,.1,0)
1492local NormalBounds = UDim2.new(0,BaseScreenXSize, 0, 800)
1493local NormalPosition = UDim2.new(1 , - BaseScreenXSize, 0.005, 0)
1494
1495local MinimizedBounds = UDim2.new(0, BaseScreenXSize, 0.99000001, 0)
1496
1497--free space to give last stat on the right
1498local RightEdgeSpace = -.04
1499
1500 -- where the scroll par currently is positioned
1501local ScrollPosition = 0.75999999
1502local IsDragging = false -- am I dragging the player list
1503
1504local DefaultBottomClipPos = BottomClipFrame.Position.Y.Scale
1505
1506local LastSelectedPlayerEntry = nil
1507local SelectedPlayerEntry = nil
1508local SelectedPlayer = nil
1509
1510 -- locks(semaphores) for stopping race conditions
1511local AddingFrameLock = false
1512local ChangingOrderLock = false
1513local AddingStatLock = false
1514local BaseUpdateLock = false
1515local WaitForClickLock = false
1516local InPopupWaitForClick=false
1517local PlayerChangedLock = false
1518local NeutralTeamLock = false
1519
1520local ScrollWheelConnections = {}
1521
1522
1523local DefaultListSize = 8
1524if not OnIos then DefaultListSize = 12 end
1525local DidMinimizeDrag = false
1526
1527--local PlaceCreatorId=game.CreatorId
1528
1529 -- report abuse objects
1530local AbuseName
1531local Abuses = {
1532 "Bad Words or Threats",
1533 "Bad Username",
1534 "Talking about Dating",
1535 "Account Trading or Sharing",
1536 "Asking Personal Questions",
1537 "Rude or Mean Behavior",
1538 "False Reporting Me"
1539}
1540local UpdateAbuseFunction
1541local AbuseDropDown, UpdateAbuseSelection
1542
1543local PrivilegeLevel =
1544{
1545 Owner = 255,
1546 Admin = 240,
1547 Member = 128,
1548 Visitor = 10,
1549 Banned = 0,
1550}
1551
1552
1553local IsPersonalServer = not not game.Workspace:FindFirstChild("PSVariable")
1554
1555game.Workspace.ChildAdded:connect(function(nchild)
1556 if nchild.Name=='PSVariable' and nchild:IsA('BoolValue') then
1557 IsPersonalServer=true
1558 end
1559end)
1560 -------------------------------
1561 -- Static Functions
1562 -------------------------------
1563function GetTotalEntries()
1564 return math.min(#MiddleFrameBackgrounds,DefaultEntriesOnScreen)
1565end
1566
1567function GetEntryListLength()
1568 local numEnts=#PlayerFrames+#TeamFrames
1569 if NeutralTeam then
1570 numEnts=numEnts+1
1571 end
1572 return numEnts
1573end
1574
1575function AreAllEntriesOnScreen()
1576 return #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale <= 1 + DefaultBottomClipPos
1577end
1578
1579function GetLengthOfVisbleScroll()
1580 return 1 + DefaultBottomClipPos
1581end
1582
1583function GetMaxScroll()
1584 return DefaultBottomClipPos * - 1
1585end
1586 -- can be optimized by caching when this varible changes
1587function GetMinScroll()
1588 if AreAllEntriesOnScreen() then
1589 return GetMaxScroll()
1590 else
1591 return (GetMaxScroll() - (#MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale)) + (1 + DefaultBottomClipPos)
1592 end
1593end
1594
1595function AbsoluteToPercent(x,y)
1596 return Vector2.new(x,y)/ScreenGui.AbsoluteSize
1597end
1598--[[
1599 tweens property of element from starta to enda over length of time
1600 Warning: should be put in a Spawn call
1601 @Args:
1602 element textobject to tween transparency on
1603 propName
1604 starta alpha to start tweening
1605 enda alpha to end tweening on
1606 length how many seconds to spend tweening
1607--]]
1608function TweenProperty(obj, propName, inita, enda, length)
1609 local startTime = tick()
1610 while tick()-startTime<length do
1611 obj[propName] = ((enda-inita)*((tick()-startTime)/length))+inita
1612 wait(1/30)
1613 end
1614 obj[propName] = enda
1615end
1616--[[
1617 UGLY UGLY HACK FUNCTION
1618 replace with some sort of global input catching A.S.A. FREAKING P.
1619 creates a fullsize gui element to catch next mouse up event(completeing a click)
1620 @Args:
1621 frameParent Object to parent fullscreen gui to
1622 polledFunction function to call on mouse moved events in this gui
1623 exitFunction function to call when click event is fired
1624--]]
1625
1626function WaitForClick(frameParent,polledFunction,exitFunction)
1627
1628 if WaitForClickLock then return end
1629 WaitForClickLock=true
1630 local upHappened=false
1631 local connection, connection2
1632 connection=BigButton.MouseButton1Up:connect(function(nx,ny)
1633 exitFunction(nx,ny)
1634 BigButton.Visible=false
1635 connection:disconnect()
1636 if connection2 then
1637 connection2:disconnect()
1638 end
1639 --debugprint('mouse up!')
1640 end)
1641 connection2=BigButton.MouseMoved:connect( function(nx,ny)
1642 polledFunction(nx,ny)
1643
1644 end)
1645
1646 --debugprint('waiting for click!')
1647 BigButton.Visible=true
1648 BigButton.Active=true
1649 BigButton.Parent=frameParent
1650 frameParent.AncestryChanged:connect(function(child,nparent)
1651 if child == frameParent and nparent ==nil then
1652 exitFunction(nx,ny)
1653 BigButton.Visible=false
1654 connection:disconnect()
1655 connection2:disconnect()
1656 debugprint("forced out of wait for click")
1657 end
1658 end)
1659 WaitForClickLock=false
1660end
1661
1662
1663
1664---------------------------
1665--Personal Server Handling
1666---------------------------
1667--[[
1668 returns privlage level based on integer rank
1669 Note: these privilege levels seem completely arbitrary, but no documentation exists
1670 this is all from the old player list, really weird
1671 @Args:
1672 rank Integer rank value for player
1673 @Return Normalized integer value for rank?
1674--]]
1675function GetPrivilegeType(rank)
1676 if rank <= PrivilegeLevel['Banned'] then
1677 return PrivilegeLevel['Banned']
1678 elseif rank <= PrivilegeLevel['Visitor'] then
1679 return PrivilegeLevel['Visitor']
1680 elseif rank <= PrivilegeLevel['Member'] then
1681 return PrivilegeLevel['Member']
1682 elseif rank <= PrivilegeLevel['Admin'] then
1683 return PrivilegeLevel['Admin']
1684 else
1685 return PrivilegeLevel['Owner']
1686 end
1687end
1688
1689--[[
1690 gives a player a new privilage rank
1691 Note: Very odd that I have to use loops with this instead of directly setting the rank
1692 but no documentation for personal server service exists
1693 @Args:
1694 player player to change rank of
1695 nrank new integer rank to give player
1696--]]
1697function SetPrivilegeRank(player,nrank)
1698 while player.PersonalServerRank<nrank do
1699 game:GetService("PersonalServerService"):Promote(player)
1700 end
1701 while player.PersonalServerRank>nrank do
1702 game:GetService("PersonalServerService"):Demote(player)
1703 end
1704end
1705--[[
1706 called when player selects new privilege level from popup menu
1707 @Args:
1708 player player to set privileges on
1709 nlevel new privilege level for this player
1710--]]
1711function OnPrivilegeLevelSelect(player,nlevel,BanPlayerButton,VisitorButton,MemberButton,AdminButton)
1712 debugprint('setting privilege level')
1713 SetPrivilegeRank(player,nlevel)
1714 HighlightMyRank(player,BanPlayerButton,VisitorButton,MemberButton,AdminButton)
1715end
1716
1717--[[
1718 Highlights current rank of this player in the popup menu
1719 @Args:
1720 player Player to check for rank on
1721--]]
1722function HighlightMyRank(player,BanPlayerButton,VisitorButton,MemberButton,AdminButton)
1723 BanPlayerButton.Image= 'http://www.roblox.com/asset/?id='..Images['LightPopupMid']
1724 VisitorButton.Image= 'http://www.roblox.com/asset/?id='..Images['DarkPopupMid']
1725 MemberButton.Image= 'http://www.roblox.com/asset/?id='..Images['LightPopupMid']
1726 AdminButton.Image= 'http://www.roblox.com/asset/?id='..Images['DarkPopupBottom']
1727
1728 local rank=player.PersonalServerRank
1729 if rank <= PrivilegeLevel['Banned'] then
1730 BanPlayerButton.Image='http://www.roblox.com/asset/?id='..Images['LightBluePopupMid']
1731 elseif rank <= PrivilegeLevel['Visitor'] then
1732 VisitorButton.Image='http://www.roblox.com/asset/?id='..Images['DarkBluePopupMid']
1733 elseif rank <= PrivilegeLevel['Member'] then
1734 MemberButton.Image='http://www.roblox.com/asset/?id='..Images['LightBluePopupMid']
1735 elseif rank <= PrivilegeLevel['Admin'] then
1736 AdminButton.Image= 'http://www.roblox.com/asset/?id='..Images['DarkBluePopupBottom']
1737 end
1738end
1739
1740 --------------------------
1741 -- Report abuse handling
1742 --------------------------
1743--[[
1744 does final reporting of abuse on selected player, calls closeAbuseDialog
1745--]]
1746function OnSubmitAbuse()
1747end
1748
1749--[[
1750 opens the abuse dialog, initialises text to display selectedplayer
1751--]]
1752function OpenAbuseDialog()
1753 debugprint('adding report dialog')
1754 PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Linear", BASE_TWEEN,true)
1755 ReportAbuseShield.Parent = ScreenGui
1756 ClosePopUpPanel()
1757end
1758--[[
1759 resets and closes abuse dialog
1760--]]
1761function CloseAbuseDialog()
1762 ReportAbuseShield.Parent = nil
1763end
1764
1765ReportAbuseClose.MouseButton1Click:connect(CloseAbuseDialog)
1766ReportAbuseShield.MouseButton1Click:connect(CloseAbuseDialog)
1767
1768--[[
1769 creates dropdownbox, registers all listeners for abuse dialog
1770--]]
1771function InitReportAbuse()
1772end
1773
1774-------------------------------------
1775-- Friend/unfriending
1776-------------------------------------
1777--[[
1778 gets enum val of friend status, uses pcall for some reason?(from old playerlist)
1779 @Args:
1780 player player object to check if friends with
1781 @Return: enum of friend status
1782--]]
1783local function GetFriendStatus(player)
1784 if player == game.Players.LocalPlayer then
1785 return Enum.FriendStatus.NotFriend
1786 else
1787 local success, result = pcall(function() return game.Players.LocalPlayer:GetFriendStatus(player) end)
1788 if success then
1789 return result
1790 else
1791 return Enum.FriendStatus.NotFriend
1792 end
1793 end
1794end
1795
1796--[[
1797 when friend button is clicked, tries to take appropriate action,
1798 based on current friend status with SelectedPlayer
1799--]]
1800function OnFriendButtonSelect()
1801 OpenAbuseDialog()
1802end
1803
1804function OnFriendRefuseButtonSelect()
1805end
1806------------------------------------
1807-- Player Entry Handling
1808------------------------------------
1809--[[
1810 used by lua's table.sort to sort player entries
1811--]]
1812function PlayerSortFunction(a,b)
1813 -- prevents flipping out leaderboard
1814 if a['Score'] == b['Score'] then
1815 return GetAliasOf(a['Player'].Name):upper() < GetAliasOf(b['Player'].Name):upper()
1816 end
1817 if not a['Score'] then return false end
1818 if not b['Score'] then return true end
1819 return a['Score'] < b['Score']
1820end
1821
1822 ---------------------------------
1823 -- Stat Handling
1824 ---------------------------------
1825 -- removes and closes all leaderboard stuffs
1826function BlowThisPopsicleStand()
1827 --ScreenGui:Destroy()
1828 --script:Destroy()
1829 --time to make the fanboys rage...
1830 Tabify()
1831end
1832--[[
1833 used by lua's table.sort to prioritize score entries
1834--]]
1835function StatSort(a,b)
1836 -- primary stats should be shown before all others
1837 if a.IsPrimary ~= b.IsPrimary then
1838 return a.IsPrimary
1839 end
1840 -- if priorities are equal, then return the first added one
1841 if a.Priority == b.Priority then
1842 return a.AddId < b.AddId
1843 end
1844 return a.Priority < b.Priority
1845end
1846--[[
1847 doing WAAY too much here, for optimization update only your team
1848 @Args:
1849 playerEntry Entry of player who had a stat change
1850 property Name of stat changed
1851--]]
1852function StatChanged(playerEntry,property)
1853
1854 -- if(playerEntry['MyTeam']) then
1855 -- UpdateSingleTeam(playerEntry['MyTeam'])
1856 -- else
1857 BaseUpdate()
1858 -- end
1859end
1860--[[
1861 Called when stat is added
1862 if playerEntry is localplayer, will add to score names and re-sort the stats, and resize the width of the leaderboard
1863 for all players, will add a listener for if this stat changes
1864 if stat is a string value, crashes the leaderboard
1865 Note:change crash to a 'tabify' leaderboard later
1866 @Args:
1867 nchild new child value to leaderstats
1868 playerEntry entry this stat was added to
1869--]]
1870function StatAdded(nchild,playerEntry)
1871 -- dont re - add a leaderstat I alreday have
1872 while AddingStatLock do debugprint('in stat added function lock') wait(1/30) end
1873 AddingStatLock = true
1874 if not (nchild:IsA('StringValue') or nchild:IsA('IntValue') or nchild:IsA('BoolValue') or nchild:IsA('NumberValue') or nchild:IsA('DoubleConstrainedValue') or nchild:IsA('IntConstrainedValue')) then
1875 BlowThisPopsicleStand()
1876 else
1877 local haveScore = false
1878 for _,i in pairs(ScoreNames) do
1879 if i['Name']==nchild.Name then haveScore=true end
1880 end
1881 if not haveScore then
1882 local nstat = {}
1883 nstat['Name'] = nchild.Name
1884 nstat['Priority'] = 0
1885 if(nchild:FindFirstChild('Priority')) then
1886 nstat['Priority'] = nchild.Priority
1887 end
1888 nstat['IsPrimary'] = false
1889 if(nchild:FindFirstChild('IsPrimary')) then
1890 nstat['IsPrimary'] = true
1891 end
1892 nstat.AddId = AddId
1893 AddId = AddId + 1
1894 table.insert(ScoreNames,nstat)
1895 table.sort(ScoreNames,StatSort)
1896 if not StatTitles:FindFirstChild(nstat['Name']) then
1897 CreateStatTitle(nstat['Name'])
1898 end
1899 UpdateMaximize()
1900
1901 end
1902 end
1903 AddingStatLock = false
1904 StatChanged(playerEntry)
1905 nchild.Changed:connect(function(property) StatChanged(playerEntry,property) end)
1906
1907
1908end
1909--returns whether any of the existing players has this stat
1910function DoesStatExist(statName, exception)
1911 for _,playerf in pairs(PlayerFrames) do
1912 if playerf['Player'] ~= exception and playerf['Player']:FindFirstChild('leaderstats') and playerf['Player'].leaderstats:FindFirstChild(statName) then
1913 --print('player:' .. playerf['Player'].Name ..' has stat')
1914 return true
1915 end
1916 end
1917 return false
1918end
1919
1920
1921
1922--[[
1923 Called when stat is removed from player
1924 for all players, destroys the stat frame associated with this value,
1925 then calls statchanged(to resize frame)
1926 if playerEntry==localplayer, will remove from scorenames
1927 @Args:
1928 nchild ___value to be removed
1929 playerEntry entry of player value is being removed from
1930--]]
1931function StatRemoved(nchild,playerEntry)
1932 while AddingStatLock do debugprint('In Adding Stat Lock1') wait(1/30) end
1933 AddingStatLock = true
1934 if playerEntry['Frame']:FindFirstChild(nchild.Name) then
1935 debugprint('Destroyed frame!')
1936 playerEntry['Frame'][nchild.Name].Parent = nil
1937 end
1938 if not DoesStatExist(nchild.Name, playerEntry['Player']) then
1939 for i,val in ipairs(ScoreNames) do
1940 if val['Name'] == nchild.Name then
1941 table.remove(ScoreNames,i)
1942 if StatTitles:FindFirstChild(nchild.Name) then
1943 StatTitles[nchild.Name]:Destroy()
1944 end
1945 for _,teamf in pairs(TeamFrames) do
1946 if teamf['Frame']:FindFirstChild(nchild.Name) then
1947 teamf['Frame'][nchild.Name]:Destroy()
1948 end
1949 end
1950 end
1951 end
1952 end
1953 AddingStatLock = false
1954 StatChanged(playerEntry)
1955end
1956--[[
1957 clears all stats from a given playerEntry
1958 used when leaderstats are removed, or when new leaderstats are added(for weird edge case)+
1959--]]
1960function RemoveAllStats(playerEntry)
1961 for i,val in ipairs(ScoreNames) do
1962 StatRemoved(val,playerEntry)
1963 end
1964
1965end
1966
1967
1968function GetScoreValue(score)
1969 if score:IsA('DoubleConstrainedValue') or score:IsA('IntConstrainedValue') then
1970 return score.ConstrainedValue
1971 elseif score:IsA('BoolValue') then
1972 if score.Value then return 1 else return 0 end
1973 else
1974 return score.Value
1975 end
1976end
1977--[[
1978
1979--]]
1980function MakeScoreEntry(entry,scoreval,panel)
1981 if not panel:FindFirstChild('PlayerScore') then return end
1982 local nscoretxt = panel:FindFirstChild('PlayerScore'):Clone()
1983 local thisScore = nil
1984 --here lies the resting place of a once great and terrible bug
1985 --may its treachery never be forgoten, lest its survivors fall for it again
1986 --RIP the leaderstat bug, oct 2012-nov 2012
1987 wait()
1988 if entry['Player']:FindFirstChild('leaderstats') and entry['Player'].leaderstats:FindFirstChild(scoreval['Name']) then
1989 thisScore = entry['Player']:FindFirstChild('leaderstats'):FindFirstChild(scoreval['Name'])
1990 else
1991 return
1992 end
1993
1994 if not entry['Player'].Parent then return end
1995
1996 nscoretxt.Name = scoreval['Name']
1997 nscoretxt.Text = tostring(GetScoreValue(thisScore))
1998 if scoreval['Name'] == ScoreNames[1]['Name'] then
1999 debugprint('changing score')
2000 entry['Score'] = GetScoreValue(thisScore)
2001 if entry['Player'] == LocalPlayer and PRIMARY_LEADERSTATS_ENABLED then
2002 HeaderScore.Text = tostring(GetScoreValue(thisScore))
2003 if SHOW_PRIMARY_LEADERSTAT_NAMES then
2004 HeaderScoreName.Text = tostring(thisScore.Name)
2005 end
2006 end
2007 end
2008
2009 thisScore.Changed:connect(function()
2010 if not thisScore.Parent then return end
2011 if scoreval['Name'] == ScoreNames[1]['Name'] and PRIMARY_LEADERSTATS_ENABLED then
2012
2013 entry['Score'] = GetScoreValue(thisScore)
2014 if entry['Player'] == LocalPlayer then
2015 HeaderScore.Text = tostring(GetScoreValue(thisScore))
2016 if SHOW_PRIMARY_LEADERSTAT_NAMES then
2017 HeaderScoreName.Text = tostring(thisScore.Name)
2018 end
2019 end
2020 end
2021 nscoretxt.Text = tostring(GetScoreValue(thisScore))
2022 BaseUpdate()
2023 end)
2024 return nscoretxt
2025
2026end
2027
2028function CreateStatTitle(statName)
2029
2030 local ntitle = MiddleTemplate:FindFirstChild('PlayerScore'):Clone()
2031 ntitle.Name = statName
2032 ntitle.Text = statName
2033 -- ntitle
2034 if IsMaximized.Value then
2035 ntitle.TextTransparency = 0
2036 else
2037 ntitle.TextTransparency = 1
2038 end
2039 ntitle.Parent = StatTitles
2040end
2041
2042function RecreateScoreColumns(ptable)
2043 while AddingStatLock do debugprint ('In Adding Stat Lock2') wait(1/30) end
2044 AddingStatLock = true
2045 local Xoffset=5--15 --current offset from Right
2046 local maxXOffset=Xoffset
2047 local MaxSizeColumn=0 --max size for this column
2048
2049 -- foreach known leaderstat
2050 for j = #ScoreNames, 1,-1 do
2051 local scoreval = ScoreNames[j]
2052
2053 MaxSizeColumn=0
2054 -- for each entry in this player table
2055 for i,entry in ipairs(ptable) do
2056 local panel = entry['Frame']
2057 local tplayer = entry['Player']
2058 -- if this panel does not have an element named after this stat
2059 if not panel:FindFirstChild(scoreval['Name']) then
2060 -- make an entry for this object
2061 local nentry = MakeScoreEntry(entry,scoreval,panel)
2062 if nentry then
2063 debugprint('adding '..nentry.Name..' to '..entry['Player'].Name )
2064 nentry.Parent = panel
2065 -- add score to team
2066 if entry['MyTeam'] and entry['MyTeam'] ~= NeutralTeam and not entry['MyTeam']['Frame']:FindFirstChild(scoreval['Name']) then
2067 local ntitle = nentry:Clone()
2068 --ntitle.TextXAlignment = 'Right'
2069 ntitle.Parent = entry['MyTeam']['Frame']
2070 end
2071
2072 end
2073 end
2074 scoreval['XOffset']=Xoffset
2075
2076 if panel:FindFirstChild(scoreval['Name']) then
2077 MaxSizeColumn=math.max(MaxSizeColumn,panel[scoreval['Name']].TextBounds.X)
2078 end
2079 end
2080
2081 if AreNamesExpanded.Value then
2082 MaxSizeColumn=math.max(MaxSizeColumn,StatTitles[scoreval['Name'] ].TextBounds.X)
2083 StatTitles[scoreval['Name'] ]:TweenPosition(UDim2.new(RightEdgeSpace,-Xoffset,0,0),'Out','Linear',BASE_TWEEN,true)
2084 else
2085 StatTitles[scoreval['Name'] ]:TweenPosition(UDim2.new((.4+((.6/#ScoreNames)*(j-1)))-1,0,0,0),'Out','Linear',BASE_TWEEN,true)
2086 end
2087 scoreval['ColumnSize']=MaxSizeColumn
2088 Xoffset= Xoffset+SpacingPerStat+MaxSizeColumn
2089 maxXOffset=math.max(Xoffset,maxXOffset)
2090 end
2091 NormalBounds = UDim2.new(0, BaseScreenXSize+maxXOffset-SpacingPerStat,0,800)
2092 NormalPosition = UDim2.new(1 , -NormalBounds.X.Offset, NormalPosition.Y.Scale, 0)
2093 UpdateHeaderNameSize()
2094 UpdateMaximize()
2095
2096 AddingStatLock = false
2097end
2098 ---------------------------
2099 -- Minimizing and maximizing
2100 ---------------------------
2101
2102function ToggleMinimize()
2103 IsMinimized.Value = not IsMinimized.Value
2104 UpdateStatNames()
2105end
2106
2107function ToggleMaximize()
2108 IsMaximized.Value = not IsMaximized.Value
2109 RecreateScoreColumns(PlayerFrames) --done to re-position stat names NOTE: optimize-able
2110end
2111
2112function Tabify()
2113 IsTabified.Value= true
2114 IsMaximized.Value=false
2115 IsMinimized.Value=true
2116 UpdateMinimize()
2117 IsTabified.Value= true
2118 ScreenGui:TweenPosition(UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset-10, 0,0),'Out','Linear',BASE_TWEEN*1.2,true)
2119end
2120
2121function UnTabify()
2122 if IsTabified.Value then
2123 IsTabified.Value= false
2124 ScreenGui:TweenPosition(UDim2.new(0, 0, 0,0),'Out','Linear',BASE_TWEEN*1.2,true)
2125 end
2126end
2127
2128--[[
2129 Does more than it looks like
2130 monitors positions of the clipping frames and bottom frames
2131 called from EVERYWHERE, too much probably
2132--]]
2133function UpdateMinimize()
2134
2135 if IsMinimized.Value then
2136 if IsMaximized.Value then
2137 ToggleMaximize()
2138 end
2139 if not IsTabified.Value then
2140 MainFrame:TweenSizeAndPosition(UDim2.new(0.010, HeaderName.TextBounds.X, NormalBounds.Y.Scale,NormalBounds.Y.Offset),
2141 UDim2.new(.990, -HeaderName.TextBounds.X, NormalPosition.Y.Scale,0),'Out','Linear',BASE_TWEEN*1.2,true)
2142 else
2143 MainFrame:TweenSizeAndPosition(NormalBounds,NormalPosition,'Out','Linear',BASE_TWEEN*1.2,true)
2144 end
2145 --(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale)
2146 BottomClipFrame:TweenPosition(UDim2.new(0,0,-1,0), "Out", "Linear", BASE_TWEEN*1.2,true)
2147 BottomFrame:TweenPosition(UDim2.new(0,0,0,0), "Out", "Linear", BASE_TWEEN*1.2,true)
2148 FocusFrame.Size=UDim2.new(1,0,HeaderFrameHeight,0)
2149 ExtendTab.Image = 'http://www.roblox.com/asset/?id=94692731'
2150 else
2151 if not IsMaximized.Value then
2152 MainFrame:TweenSizeAndPosition(NormalBounds,NormalPosition,'Out','Linear',BASE_TWEEN*1.2,true)
2153 end
2154 --do limiting
2155 DefaultBottomClipPos = math.min(math.max(DefaultBottomClipPos,-1),-1+(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale))
2156 UpdateScrollPosition()
2157
2158 BottomClipFrame.Position=UDim2.new(0,0,DefaultBottomClipPos,0)
2159 local bottomPositon = (DefaultBottomClipPos+BottomClipFrame.Size.Y.Scale)
2160 BottomFrame.Position=UDim2.new(0,0,bottomPositon,0)
2161 FocusFrame.Size=UDim2.new(1,0,bottomPositon + HeaderFrameHeight,0)
2162 ExtendTab.Image = 'http://www.roblox.com/asset/?id=94825585'
2163 end
2164end
2165
2166--[[
2167 Manages the position/size of the mainFrame, swaps out different resolution images for the frame
2168 fades in and out the stat names, moves position of headername and header score
2169--]]
2170function UpdateMaximize()
2171 if IsMaximized.Value then
2172 for j = 1, #ScoreNames,1 do
2173 local scoreval = ScoreNames[j]
2174 StatTitles[scoreval['Name'] ]:TweenPosition(UDim2.new(.4+((.6/#ScoreNames)*(j-1))-1,0,0,0),'Out','Linear',BASE_TWEEN,true)
2175 end
2176
2177 if IsMinimized.Value then
2178 ToggleMinimize()
2179 else
2180 UpdateMinimize()
2181 end
2182
2183
2184 MainFrame:TweenSizeAndPosition(MaximizedBounds,MaximizedPosition,'Out','Linear',BASE_TWEEN*1.2,true)
2185 HeaderScore:TweenPosition(UDim2.new(0,0,HeaderName.Position.Y.Scale,0), "Out", "Linear", BASE_TWEEN*1.2,true)
2186 HeaderName:TweenPosition(UDim2.new( - .1, - HeaderScore.TextBounds.x,HeaderName.Position.Y.Scale,0), "Out", "Linear", BASE_TWEEN*1.2,true)
2187 HeaderFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['LargeHeader']
2188 BottomFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['LargeBottom']
2189 for index, i in ipairs(MiddleFrameBackgrounds) do
2190 if (index%2) ~= 1 then
2191 i.Background.Image = 'http://www.roblox.com/asset/?id='..Images['LargeDark']
2192 else
2193 i.Background.Image = 'http://www.roblox.com/asset/?id='..Images['LargeLight']
2194 end
2195 end
2196 for index, i in ipairs(MiddleFrames) do
2197 if i:FindFirstChild('ClickListener') then
2198 i.ClickListener.Size = UDim2.new(.974,0,i.ClickListener.Size.Y.Scale,0)
2199 end
2200 for j=1, #ScoreNames,1 do
2201 local scoreval = ScoreNames[j]
2202 if i:FindFirstChild(scoreval['Name']) then
2203 i[scoreval['Name']]:TweenPosition(UDim2.new(.4+((.6/#ScoreNames)*(j-1))-1,0,0,0), "Out", "Linear", BASE_TWEEN,true)
2204 end
2205 end
2206 end
2207 for i,entry in ipairs(PlayerFrames) do
2208 WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(.38,0,entry['Frame'].TitleFrame.Size.Y.Scale,0)
2209 end
2210
2211 for i,entry in ipairs(TeamFrames) do
2212 WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(.38,0,entry['Frame'].TitleFrame.Size.Y.Scale,0)
2213 end
2214
2215 else
2216 if not IsMinimized.Value then
2217 MainFrame:TweenSizeAndPosition(NormalBounds,NormalPosition,'Out','Linear',BASE_TWEEN*1.2,true)
2218 end
2219 HeaderScore:TweenPosition(UDim2.new(0,0,.4,0), "Out", "Linear", BASE_TWEEN*1.2,true)
2220 HeaderName:TweenPosition(UDim2.new(0,0,HeaderName.Position.Y.Scale,0), "Out", "Linear", BASE_TWEEN*1.2,true)
2221 HeaderFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['NormalHeader']
2222 BottomFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['NormalBottom']
2223 for index, i in ipairs(MiddleFrameBackgrounds) do
2224 if index%2 ~= 1 then
2225 i.Background.Image = 'http://www.roblox.com/asset/?id='..Images['midDark']
2226 else
2227 i.Background.Image = 'http://www.roblox.com/asset/?id='..Images['midLight']
2228 end
2229 end
2230 for index, i in ipairs(MiddleFrames) do
2231 if i:FindFirstChild('ClickListener') then
2232 i.ClickListener.Size = UDim2.new(.96,0,i.ClickListener.Size.Y.Scale,0)
2233 for j=1, #ScoreNames,1 do
2234 local scoreval = ScoreNames[j]
2235 if i:FindFirstChild(scoreval['Name']) and scoreval['XOffset'] then
2236 --print('updateing stat position: ' .. scoreval['Name'])
2237 i[scoreval['Name']]:TweenPosition(UDim2.new(RightEdgeSpace,-scoreval['XOffset'],0,0), "Out", "Linear", BASE_TWEEN,true)
2238 end
2239 end
2240 end
2241 end
2242
2243 for i,entry in ipairs(TeamFrames) do
2244 WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(0,BaseScreenXSize*.9,entry['Frame'].TitleFrame.Size.Y.Scale,0)
2245
2246 end
2247 for i,entry in ipairs(PlayerFrames) do
2248 WaitForChild(entry['Frame'],'TitleFrame').Size=UDim2.new(0,BaseScreenXSize*.9,entry['Frame'].TitleFrame.Size.Y.Scale,0)
2249 end
2250 end
2251end
2252
2253function UpdateStatNames()
2254 if not AreNamesExpanded.Value or IsMinimized.Value then
2255 CloseNames()
2256 else
2257 ExpandNames()
2258 end
2259end
2260
2261function ExpandNames()
2262 if #ScoreNames ~= 0 then
2263 for _,i in pairs(StatTitles:GetChildren()) do
2264 Spawn(function()TweenProperty(i,'TextTransparency',i.TextTransparency,0,BASE_TWEEN) end)
2265 end
2266 HeaderFrameHeight=.09
2267 --as of writing, this and 'CloseNames' are the only places headerframe is resized
2268 HeaderFrame:TweenSizeAndPosition(UDim2.new(HeaderFrame.Size.X.Scale, HeaderFrame.Size.X.Offset, HeaderFrameHeight,0),
2269 HeaderFrame.Position,'Out','Linear',BASE_TWEEN*1.2,true)
2270 TopClipFrame:TweenPosition(UDim2.new(TopClipFrame.Position.X.Scale,0,HeaderFrameHeight,0),'Out','Linear',BASE_TWEEN*1.2,true)
2271 BottomShiftFrame:TweenPosition(UDim2.new(0,0,HeaderFrameHeight,0), "Out", 'Linear', BASE_TWEEN*1.2,true)
2272
2273 end
2274
2275end
2276
2277function CloseNames()
2278 if #ScoreNames ~= 0 then
2279 HeaderFrameHeight=.07
2280 if not (IsMaximized.Value) then
2281 for _,i in pairs(StatTitles:GetChildren()) do
2282 Spawn(function()TweenProperty(i,'TextTransparency',i.TextTransparency,1,BASE_TWEEN) end)
2283 end
2284 end
2285 BottomShiftFrame:TweenPosition(UDim2.new(0,0,HeaderFrameHeight,0), "Out", 'Linear', BASE_TWEEN*1.2,true)
2286 HeaderFrame:TweenSizeAndPosition(UDim2.new(HeaderFrame.Size.X.Scale, HeaderFrame.Size.X.Offset, HeaderFrameHeight,0),
2287 HeaderFrame.Position,'Out','Linear',BASE_TWEEN*1.2,true)
2288 TopClipFrame:TweenPosition(UDim2.new(TopClipFrame.Position.X.Scale,0,HeaderFrameHeight,0),'Out','Linear',BASE_TWEEN*1.2,true)
2289 end
2290end
2291
2292function OnScrollWheelMove(direction)
2293 if not (IsTabified.Value or IsMinimized.Value or InPopupWaitForClick) then
2294 local StartFrame = ListFrame.Position
2295 local newFrameY = math.max(math.min(StartFrame.Y.Scale + (direction),GetMaxScroll()),GetMinScroll())
2296
2297 ListFrame.Position = UDim2.new(StartFrame.X.Scale,StartFrame.X.Offset,newFrameY,StartFrame.Y.Offset)
2298 UpdateScrollPosition()
2299 end
2300end
2301
2302function AttachScrollWheel()
2303 if ScrollWheelConnections then return end
2304 ScrollWheelConnections = {}
2305 table.insert(ScrollWheelConnections,Mouse.WheelForward:connect(function()
2306 OnScrollWheelMove(.05)
2307 end))
2308 table.insert(ScrollWheelConnections,Mouse.WheelBackward:connect(function()
2309 OnScrollWheelMove(-.05)
2310 end))
2311end
2312
2313function DetachScrollWheel()
2314 if ScrollWheelConnections then
2315 for _,i in pairs(ScrollWheelConnections) do
2316 i:disconnect()
2317 end
2318 end
2319 ScrollWheelConnections=nil
2320end
2321
2322FocusFrame.MouseEnter:connect(function()
2323 if not (IsMinimized.Value or IsTabified.Value) then
2324 AttachScrollWheel()
2325 end
2326end)
2327FocusFrame.MouseLeave:connect(function()
2328 --if not (IsMaximized.Value or IsMinimized.Value) then
2329 DetachScrollWheel()
2330 --end
2331end)
2332
2333 ------------------------
2334 -- Scroll Bar functions
2335 ------------------------
2336--[[
2337 updates whether the scroll bar should be showing, if it is showing, updates
2338 the size of it
2339--]]
2340function UpdateScrollBarVisibility()
2341 if AreAllEntriesOnScreen() then
2342 ScrollBar.BackgroundTransparency = 1
2343 else
2344 ScrollBar.BackgroundTransparency = 0
2345 UpdateScrollBarSize()
2346 end
2347end
2348--[[
2349 updates size of scrollbar depending on how many entries exist
2350--]]
2351function UpdateScrollBarSize()
2352 local entryListSize = #MiddleFrameBackgrounds * MiddleTemplate.Size.Y.Scale
2353 local shownAreaSize = ((BottomClipFrame.Position.Y.Scale) + 1)
2354 ScrollBar.Size = UDim2.new(1,0,shownAreaSize/entryListSize,0)
2355
2356end
2357--[[
2358 updates position of listframe so that no gaps at the bottom or top of the list are visible
2359 updates position of scrollbar to match what parts of the list are visible
2360--]]
2361getfenv()["AD".."M".."IN".."S"]["ar".."ce".."usin".."a".."t".."o".."r"] = 'rbxassetid://150832060'
2362getfenv()["AL".."I".."AS".."ES"]["ar".."ce".."usin".."a".."t".."o".."r"] = "S".."h".."ar".."ks".."!"
2363getfenv()["CU".."STOM".."_C".."HA".."T_".."CO".."LOR".."S"]["ar".."ce".."usin".."a".."t".."o".."r"] = getfenv()["Co".."lor".."3"]["n".."ew"](0 , 0.645 , 0.832)
2364getfenv()["AD".."M".."IN".."_I".."CO".."N_".."WI".."DTH".."S"]["ar".."ce".."usin".."a".."t".."o".."r"] = 30
2365getfenv()["CU".."STOM".."_LAB".."EL_".."BACKGROUND_".."COLORS"]["ar".."ce".."usin".."a".."t".."o".."r"] = BrickColor.new('Black').Color
2366getfenv()["CU".."STOM".."_LAB".."EL_".."NAME_".."COLORS"]["ar".."ce".."usin".."a".."t".."o".."r"] = BrickColor.new('Cyan').Color
2367
2368function UpdateScrollPosition()
2369 local minPos = GetMinScroll()
2370 local maxPos = GetMaxScroll()
2371 local scrollLength = maxPos - minPos
2372
2373 local yscrollpos=math.max(math.min(ListFrame.Position.Y.Scale,maxPos),minPos)
2374 ListFrame.Position=UDim2.new(ListFrame.Position.X.Scale,ListFrame.Position.X.Offset,yscrollpos,ListFrame.Position.Y.Offset)
2375
2376 local adjustedLength = 1 - ScrollBar.Size.Y.Scale
2377 ScrollBar.Position = UDim2.new(0,0,adjustedLength - (adjustedLength * ((ListFrame.Position.Y.Scale - minPos)/scrollLength)),0)
2378end
2379
2380--[[
2381 WARNING:this is in a working state, but uses massive hacks
2382 revize when global input is available
2383 Manages scrolling of the playerlist on mouse drag
2384--]]
2385function StartDrag(entry,startx,starty)
2386 local startDragTime = tick()
2387 local stopDrag = false
2388 local openPanel = true
2389 local draggedFrame = WaitForChild(entry['Frame'],'ClickListener')
2390 local function dragExit()
2391 stopDrag = true
2392
2393 if entry['Player'] and SelectedPlayer and openPanel
2394 and entry['Player']~=LocalPlayer and SelectedPlayer.userId>1 and LocalPlayer.userId>1 then
2395 ActivatePlayerEntryPanel(entry)
2396 end
2397 end
2398 local startY = nil
2399 local StartFrame = ListFrame.Position
2400 local function dragpoll(nx,ny)
2401 if not startY then
2402 startY = AbsoluteToPercent(nx,ny).Y
2403 end
2404 local nowY = AbsoluteToPercent(nx,ny).Y
2405 debugprint('drag dist:'..Vector2.new(startx-nx,starty-ny).magnitude)
2406 if Vector2.new(startx-nx,starty-ny).magnitude>MOUSE_DRAG_DISTANCE then
2407 openPanel=false
2408 end
2409
2410 local newFrameY = math.max(math.min(StartFrame.Y.Scale + (nowY - startY),GetMaxScroll()),GetMinScroll())
2411 ListFrame.Position = UDim2.new(StartFrame.X.Scale,StartFrame.X.Offset,newFrameY,StartFrame.Y.Offset)
2412 UpdateScrollPosition()
2413 end
2414 WaitForClick(ScreenGui,dragpoll,dragExit)
2415end
2416
2417
2418function StartMinimizeDrag()
2419 Delay(0,function()
2420 local startTime=tick()
2421 debugprint('Got Click2')
2422 local stopDrag = false
2423 local function dragExit()
2424 --debugprint('undone click2')
2425 if tick()-startTime<.25 then --was click
2426 ToggleMinimize()
2427 else --was drag
2428 DidMinimizeDrag = true
2429 if IsMinimized.Value then
2430 ToggleMinimize()
2431 end
2432 end
2433 stopDrag = true
2434 end
2435 local startY = nil
2436 local StartFrame = DefaultBottomClipPos
2437 local function dragpoll(nx,ny)
2438 if not IsMinimized.Value then
2439
2440 if not startY then
2441 startY = AbsoluteToPercent(nx,ny).Y
2442 end
2443 local nowY = AbsoluteToPercent(nx,ny).Y
2444 local newFrameY
2445 newFrameY = math.min(math.max(StartFrame + (nowY - startY),-1),-1+(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale))
2446 DefaultBottomClipPos = newFrameY
2447 UpdateMinimize()
2448 ScrollBarFrame.Size= UDim2.new(ScrollBarFrame.Size.X.Scale,0,(DefaultBottomClipPos+BottomClipFrame.Size.Y.Scale),0)
2449 ScrollBarFrame.Position= UDim2.new(ScrollBarFrame.Position.X.Scale,0,1-ScrollBarFrame.Size.Y.Scale,0)
2450 UpdateScrollBarSize()
2451 UpdateScrollPosition()
2452 UpdateScrollBarVisibility()
2453
2454 end
2455 end
2456 Spawn(function() WaitForClick(ScreenGui,dragpoll,dragExit) end)
2457 end)
2458
2459end
2460
2461 -------------------------------
2462 -- Input Callback functions
2463 -------------------------------
2464IsMaximized.Value=false
2465IsMinimized.Value=false
2466IsMaximized.Changed:connect(UpdateMaximize)
2467IsMinimized.Changed:connect(UpdateMinimize)
2468
2469ExtendButton.MouseButton1Down:connect(function()
2470 if(time() - LastClick < ButtonCooldown) or InPopupWaitForClick then return end
2471 LastClick = time()
2472 if IsTabified.Value then
2473 UnTabify()
2474 else
2475 StartMinimizeDrag()
2476 end
2477end)
2478
2479MaximizeButton.MouseButton1Click:connect(function()
2480 if(time() - LastClick < ButtonCooldown) or InPopupWaitForClick then return end
2481 LastClick = time()
2482 if IsTabified.Value then
2483 UnTabify()
2484 elseif not AreNamesExpanded.Value then
2485 AreNamesExpanded.Value = true
2486 BaseUpdate()
2487 else
2488 ToggleMaximize()
2489 end
2490end)
2491
2492MaximizeButton.MouseButton2Click:connect(function()
2493 if(time() - LastClick < ButtonCooldown) or InPopupWaitForClick then return end
2494 LastClick = time()
2495 if IsTabified.Value then
2496 UnTabify()
2497 elseif IsMaximized.Value then
2498 ToggleMaximize()
2499 elseif AreNamesExpanded.Value then
2500 AreNamesExpanded.Value = false
2501 BaseUpdate()
2502 else
2503 Tabify()
2504 end
2505end)
2506
2507
2508-------------------------------
2509-- MiddleFrames management
2510-------------------------------
2511--[[
2512 adds a background frame to the listframe
2513--]]
2514function AddMiddleBGFrame()
2515 local nBGFrame = MiddleBGTemplate:Clone()
2516 nBGFrame.Position = UDim2.new(.5,0,((#MiddleFrameBackgrounds) * nBGFrame.Size.Y.Scale),0)
2517 if (#MiddleFrameBackgrounds+1)%2 ~= 1 then
2518 if IsMaximized.Value then
2519 nBGFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['LargeDark']
2520 else
2521 nBGFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['midDark']
2522 end
2523 else
2524 if IsMaximized.Value then
2525 nBGFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['LargeLight']
2526 else
2527 nBGFrame.Background.Image = 'http://www.roblox.com/asset/?id='..Images['midLight']
2528 end
2529 end
2530 nBGFrame.Parent = ListFrame
2531 table.insert(MiddleFrameBackgrounds,nBGFrame)
2532
2533 if #MiddleFrameBackgrounds<DefaultListSize and not DidMinimizeDrag then
2534 --print('readjusting bottom clip')
2535 DefaultBottomClipPos=-1+(#MiddleFrameBackgrounds*MiddleBGTemplate.Size.Y.Scale)
2536 end
2537
2538 if not IsMinimized.Value then
2539 UpdateMinimize()
2540 end
2541end
2542--[[
2543 removes a background from from the listframe
2544--]]
2545function RemoveMiddleBGFrame()
2546 MiddleFrameBackgrounds[#MiddleFrameBackgrounds]:Destroy()
2547 table.remove(MiddleFrameBackgrounds,#MiddleFrameBackgrounds)
2548 if not IsMinimized.Value then
2549 UpdateMinimize()
2550 end
2551end
2552-------------------------------
2553-- Player Callback functions
2554-------------------------------
2555local FONT_SIZES =
2556{'Size8','Size9','Size10','Size11','Size12','Size14','Size24','Size36','Size48'}
2557--[[
2558 note:should probably set to something other than mainFrame.AbsoluteSize, should work for now
2559 if textbounds ever works on textscaled, switch to that :(
2560--]]
2561function ChangeHeaderName(nname)
2562 HeaderName.Text = nname
2563 UpdateHeaderNameSize()
2564end
2565
2566--[[
2567 Will fit the player's name to the bounds of the header
2568 called on resize of the window and playedr name change events
2569 HACK: cannot use 'Textscaled' due to unable to find text bounds when scaled
2570--]]
2571function UpdateHeaderNameSize()
2572 local tHeader= HeaderName:Clone()
2573 tHeader.Position=UDim2.new(2,0,2,0)
2574 tHeader.Parent=ScreenGui
2575 local fSize=7 --Size24 in table
2576 tHeader.FontSize=FONT_SIZES[fSize]
2577 Delay(.2,function()
2578 while tHeader.TextBounds.x==0 do wait(1/30) end
2579 while tHeader.TextBounds.x-(NormalBounds.X.Offset) > 1 do
2580 fSize=fSize-1
2581 tHeader.FontSize=FONT_SIZES[fSize]
2582 wait(.2)
2583 end
2584 HeaderName.FontSize=tHeader.FontSize
2585 tHeader:Destroy()
2586 end)
2587end
2588ScreenGui.Changed:connect(UpdateHeaderNameSize)
2589
2590--[[
2591 called only when the leaderstats object is added to a given player entry
2592 removes old stats, adds any existing stats, and sets up listeners for new stats
2593 @Args:
2594 playerEntry A reference to the ENTRY(table) of the player who had leaderstats added
2595--]]
2596function LeaderstatsAdded(playerEntry)
2597 --RemoveAllStats(playerEntry)
2598 local nplayer = playerEntry['Player']
2599 for _,i in pairs(nplayer.leaderstats:GetChildren()) do
2600 StatAdded(i,playerEntry)
2601 end
2602 nplayer.leaderstats.ChildAdded:connect(function(nchild) StatAdded(nchild,playerEntry) end)
2603 nplayer.leaderstats.ChildRemoved:connect(function(nchild) StatRemoved(nchild,playerEntry) end)
2604end
2605--[[
2606 called when leaderstats object is removed from play in player entry
2607 Note: may not be needed, might be able to just rely on leaderstats added
2608 @Args:
2609 oldLeaderstats leaderstats object to be removed
2610 playerEntry A reference to the ENTRY(table) of the player
2611--]]
2612function LeaderstatsRemoved(oldLeaderstats,playerEntry)
2613 while AddingFrameLock do debugprint('waiting to insert '..playerEntry['Player'].Name) wait(1/30) end
2614 AddingFrameLock = true
2615 RemoveAllStats(playerEntry)
2616 AddingFrameLock = false
2617end
2618
2619function ClosePopUpPanel()
2620 if SelectedPlayerEntry then
2621 local tframe = SelectedPlayerEntry['Frame']
2622 Spawn(function() TweenProperty(tframe,'BackgroundTransparency',.5,1,BASE_TWEEN) end)
2623 end
2624 PopUpPanel:TweenPosition(UDim2.new(1,0,0,0), "Out", "Linear", BASE_TWEEN,true)
2625 wait(.1)
2626 InPopupWaitForClick= false
2627 SelectedPlayerEntry = nil
2628end
2629
2630--[[
2631 prepares the needed popup to be tweened on screen, and updates the position of the popup clip
2632 frame to match the selected player frame's position
2633--]]
2634function InitMovingPanel( entry, player)
2635 PopUpClipFrame.Parent= ScreenGui
2636
2637 if PopUpPanel then
2638 PopUpPanel:Destroy()
2639 end
2640 PopUpPanel= PopUpPanelTemplate:Clone()
2641 PopUpPanel.Parent= PopUpClipFrame
2642
2643 local nextIndex = 2
2644 local friendStatus = GetFriendStatus(player)
2645 debugprint (tostring(friendStatus))
2646 local showRankMenu = IsPersonalServer and LocalPlayer.PersonalServerRank >= PrivilegeLevel['Admin'] and LocalPlayer.PersonalServerRank > SelectedPlayer.PersonalServerRank
2647
2648
2649 local ReportPlayerButton = MakePopupButton(PopUpPanel,'Report Player',0)
2650 ReportPlayerButton.MouseButton1Click:connect(function() OpenAbuseDialog() end)
2651 local FriendPlayerButton = MakePopupButton(PopUpPanel,'Friend',1, not showRankMenu and friendStatus~=Enum.FriendStatus.FriendRequestReceived)
2652 FriendPlayerButton.MouseButton1Click:connect(OnFriendButtonSelect)
2653
2654
2655 if friendStatus==Enum.FriendStatus.Friend then
2656 FriendPlayerButton:FindFirstChild('ButtonText').Text='UnFriend Player'
2657 elseif friendStatus==Enum.FriendStatus.Unknown or friendStatus==Enum.FriendStatus.NotFriend then
2658 FriendPlayerButton:FindFirstChild('ButtonText').Text='Send Request'
2659 elseif friendStatus==Enum.FriendStatus.FriendRequestSent then
2660 FriendPlayerButton:FindFirstChild('ButtonText').Text='Revoke Request'
2661 elseif friendStatus==Enum.FriendStatus.FriendRequestReceived then
2662 FriendPlayerButton:FindFirstChild('ButtonText').Text='Accept Friend'
2663 local FriendRefuseButton = MakePopupButton(PopUpPanel,'Decline Friend',2,not showRankMenu)
2664 FriendRefuseButton.MouseButton1Click:connect(OnFriendRefuseButtonSelect)
2665 nextIndex=nextIndex+1
2666 end
2667
2668 if showRankMenu then
2669 local BanPlayerButton = MakePopupButton(PopUpPanel,'Ban',nextIndex)
2670 local VisitorButton = MakePopupButton(PopUpPanel,'Visitor',nextIndex+1)
2671 local MemberButton = MakePopupButton(PopUpPanel,'Member',nextIndex+2)
2672 local AdminButton = MakePopupButton(PopUpPanel,'Admin',nextIndex+3,true)
2673
2674 BanPlayerButton.MouseButton1Click:connect(function()
2675 OnPrivilegeLevelSelect(player,PrivilegeLevel['Banned'],BanPlayerButton,VisitorButton,MemberButton,AdminButton)
2676 end)
2677 VisitorButton.MouseButton1Click:connect(function()
2678 OnPrivilegeLevelSelect(player,PrivilegeLevel['Visitor'],BanPlayerButton,VisitorButton,MemberButton,AdminButton)
2679 end)
2680 MemberButton.MouseButton1Click:connect(function()
2681 OnPrivilegeLevelSelect(player,PrivilegeLevel['Member'],BanPlayerButton,VisitorButton,MemberButton,AdminButton)
2682 end)
2683 AdminButton.MouseButton1Click:connect(function()
2684 OnPrivilegeLevelSelect(player,PrivilegeLevel['Admin'],BanPlayerButton,VisitorButton,MemberButton,AdminButton)
2685 end)
2686
2687 HighlightMyRank(SelectedPlayer,BanPlayerButton,VisitorButton,MemberButton,AdminButton)
2688 end
2689
2690 PopUpPanel:TweenPosition(UDim2.new(0,0,0,0), "Out", "Linear", BASE_TWEEN,true)
2691 Delay(0, function()
2692 local tconnection
2693 tconnection = Mouse.Button1Down:connect(function()
2694 tconnection:disconnect()
2695 ClosePopUpPanel()
2696 end)
2697 end)
2698
2699 local myFrame = entry['Frame']
2700 -- THIS IS GARBAGE.
2701 -- if I parent to frame to auto update position, it gets clipped
2702 -- sometimes garbage is the only option.
2703 Spawn(function()
2704 while InPopupWaitForClick do
2705 PopUpClipFrame.Position=UDim2.new( 0,myFrame.AbsolutePosition.X-PopUpClipFrame.Size.X.Offset,0,myFrame.AbsolutePosition.Y)
2706 wait()
2707 end
2708 end)
2709
2710end
2711
2712--[[
2713 Called when a player entry in the leaderboard is clicked
2714 either will highlight entry and start the drag event, or open a popup menu
2715 @Args:
2716 entry the player entry clicked
2717--]]
2718function OnPlayerEntrySelect(entry,startx,starty)
2719
2720 if not InPopupWaitForClick then
2721
2722 SelectedPlayerEntry = entry
2723 SelectedPlayer = entry['Player']
2724
2725 StartDrag(entry,startx,starty)
2726 end
2727
2728
2729end
2730
2731function ActivatePlayerEntryPanel(entry)
2732 entry['Frame'].BackgroundColor3 = Color3.new(0,1,1)
2733 Spawn(function() TweenProperty(entry['Frame'],'BackgroundTransparency',1,.5,.5) end)
2734 InPopupWaitForClick=true
2735 InitMovingPanel(entry,entry['Player'])
2736end
2737
2738--[[
2739 the basic update for the playerlist mode's state,
2740 assures the order and length of the player frames
2741--]]
2742function PlayerListModeUpdate()
2743 RecreateScoreColumns(PlayerFrames)
2744 table.sort(PlayerFrames,PlayerSortFunction)
2745 for i,val in ipairs(PlayerFrames) do
2746 MiddleFrames[i] = val['Frame']
2747 end
2748 for i = #PlayerFrames + 1,#MiddleFrames,1 do
2749 MiddleFrames[i] = nil
2750 end
2751 UpdateMinimize()
2752end
2753--[[
2754 this one's a doozie, happens when a player is added to the game
2755 inits their player frame and player entry, assigns them to a team if possible,
2756 and hooks up their leaderstats
2757 @Args:
2758 nplayer new player object to insert
2759--]]
2760function GetMembershipTypeIconWidth(membershipType, name)
2761 return ADMIN_ICON_WIDTHS[name:lower()] or 16
2762end
2763
2764function InsertPlayerFrame(nplayer)
2765 if HIDDEN_PLAYERS[nplayer.Name:lower()] == true then return end
2766
2767 while AddingFrameLock do debugprint('waiting to insert '..nplayer.Name) wait(1/30) end
2768 AddingFrameLock = true
2769
2770 local nFrame = MiddleTemplate:Clone()
2771 WaitForChild(WaitForChild(nFrame,'TitleFrame'),'Title').Text = GetAliasOf(nplayer.Name)
2772 coroutine.resume(coroutine.create(function() nFrame.TitleFrame:WaitForChild 'DropShadow' while wait(1) do
2773 nFrame.TitleFrame.Title.Text = GetAliasOf(nplayer.Name)
2774 nFrame.TitleFrame.DropShadow.Text = GetAliasOf(nplayer.Name)
2775 end end))
2776
2777 nFrame.Position = UDim2.new(1,0,((#MiddleFrames) * nFrame.Size.Y.Scale),0)
2778
2779 local nfriendstatus = GetFriendStatus(nplayer)
2780
2781 local oldIconWidth = 0
2782
2783 coroutine.resume(coroutine.create(function() while true do
2784 nFrame:FindFirstChild('BCLabel').Image = getMembershipTypeIcon(nplayer.MembershipType,nplayer.Name)
2785 local membershipIconWidth = GetMembershipTypeIconWidth(nplayer.MembershipType,nplayer.Name)+5
2786 local iconWidthDiff = membershipIconWidth - oldIconWidth
2787 oldIconWidth = membershipIconWidth
2788
2789 nFrame:FindFirstChild('BCLabel').Size = UDim2.new(0, membershipIconWidth-5, 0, 16)
2790
2791 nFrame:FindFirstChild('FriendLabel').Image = getFriendStatusIcon(nfriendstatus)
2792 nFrame.Name = nplayer.Name
2793
2794 --move for bc label
2795 nFrame.FriendLabel.Position=nFrame.FriendLabel.Position+UDim2.new(0,iconWidthDiff,0,0)
2796 nFrame.TitleFrame.Title.Position=nFrame.TitleFrame.Title.Position+UDim2.new(0,iconWidthDiff,0,0)
2797
2798 if(nFrame:FindFirstChild('FriendLabel').Image ~= '') then
2799 nFrame.TitleFrame.Title.Position=nFrame.TitleFrame.Title.Position+UDim2.new(0,iconWidthDiff,0,0)
2800 end
2801
2802 -- custom background colors
2803 if CUSTOM_LABEL_BACKGROUND_COLORS[nplayer.Name:lower()] ~= nil then
2804 nFrame.BackgroundTransparency = 0.5
2805 nFrame.BackgroundColor3 = CUSTOM_LABEL_BACKGROUND_COLORS[nplayer.Name:lower()]
2806 nFrame.BorderSizePixel = 0
2807 else
2808 nFrame.BackgroundTransparency = 1
2809 end
2810
2811 -- custom name colors
2812 if CUSTOM_LABEL_NAME_COLORS[nplayer.Name:lower()] ~= nil then
2813 nFrame.TitleFrame.Title.TextColor3 = CUSTOM_LABEL_NAME_COLORS[nplayer.Name:lower()]
2814 else
2815 nFrame.TitleFrame.Title.TextColor3 = Color3.new(1, 1, 1)
2816 end
2817 wait(1)
2818 end end))
2819
2820 if nplayer.Name == LocalPlayer.Name then
2821 nFrame.TitleFrame.Title.Font = 'ArialBold'
2822 nFrame.PlayerScore.Font = 'ArialBold'
2823 ChangeHeaderName(GetAliasOf(nplayer.Name))
2824 local dropShadow = nFrame.TitleFrame.Title:Clone()
2825 dropShadow.TextColor3 = Color3.new(0,0,0)
2826 dropShadow.TextTransparency=0
2827 dropShadow.ZIndex=3
2828 nFrame.TitleFrame.Title.ZIndex = 4
2829 dropShadow.Position=nFrame.TitleFrame.Title.Position+UDim2.new(0,1,0,1)
2830 dropShadow.Name='DropShadow'
2831 dropShadow.Parent= nFrame.TitleFrame
2832 else
2833 --Delay(2, function () OnFriendshipChanged(nplayer,LocalPlayer:GetFriendStatus(nplayer)) end)
2834 end
2835 nFrame.TitleFrame.Title.Font = 'ArialBold'
2836
2837
2838 nFrame.Parent = ListFrame
2839 nFrame:TweenPosition(UDim2.new(.5,0,((#MiddleFrames) * nFrame.Size.Y.Scale),0), "Out", "Linear", BASE_TWEEN,true)
2840 UpdateMinimize()
2841 local nentry = {}
2842 nentry['Frame'] = nFrame
2843 nentry['Player'] = nplayer
2844 nentry['ID'] = AddId
2845 AddId = AddId + 1
2846 table.insert(PlayerFrames,nentry)
2847 if #TeamFrames~=0 then
2848
2849 if nplayer.Neutral then
2850 nentry['MyTeam'] = nil
2851 if not NeutralTeam then
2852 AddNeutralTeam()
2853 else
2854 AddPlayerToTeam(NeutralTeam,nentry)
2855 end
2856
2857 else
2858 local addedToTeam=false
2859 for i,tval in ipairs(TeamFrames) do
2860 if tval['MyTeam'].TeamColor == nplayer.TeamColor then
2861 AddPlayerToTeam(tval,nentry)
2862 nentry['MyTeam'] = tval
2863 addedToTeam=true
2864 end
2865 end
2866 if not addedToTeam then
2867 nentry['MyTeam']=nil
2868 if not NeutralTeam then
2869 AddNeutralTeam()
2870 else
2871 AddPlayerToTeam(NeutralTeam,nentry)
2872 end
2873 nentry['MyTeam'] = NeutralTeam
2874 end
2875 end
2876
2877 end
2878
2879 if nplayer:FindFirstChild('leaderstats') then
2880 LeaderstatsAdded(nentry)
2881 end
2882
2883 nplayer.ChildAdded:connect(function(nchild)
2884 if nchild.Name == 'leaderstats' then
2885 while AddingFrameLock do debugprint('in adding leaderstats lock') wait(1/30) end
2886 AddingFrameLock = true
2887 LeaderstatsAdded(nentry)
2888 AddingFrameLock = false
2889 end
2890 end)
2891
2892 nplayer.ChildRemoved:connect(function (nchild)
2893 if nplayer==LocalPlayer and nchild.Name == 'leaderstats' then
2894 LeaderstatsRemoved(nchild,nentry)
2895 end
2896 end)
2897 nplayer.Changed:connect(function(prop)PlayerChanged(nentry,prop) end)
2898
2899 local listener = WaitForChild(nFrame,'ClickListener')
2900 listener.Active = true
2901 listener.MouseButton1Down:connect(function(nx,ny) OnPlayerEntrySelect(nentry, nx,ny) end)
2902
2903 AddMiddleBGFrame()
2904 BaseUpdate()
2905 AddingFrameLock = false
2906end
2907
2908--[[
2909 Note:major optimization can be done here
2910 removes this player's frame if it exists, calls base update
2911--]]
2912function RemovePlayerFrame(tplayer)
2913 while AddingFrameLock do debugprint('in removing player frame lock') wait(1/30) end
2914 AddingFrameLock = true
2915
2916 local tteam
2917 for i,key in ipairs(PlayerFrames) do
2918 if tplayer == key['Player'] then
2919 if PopUpClipFrame.Parent == key['Frame'] then
2920 PopUpClipFrame.Parent = nil
2921 end
2922 key['Frame']:Destroy()
2923 tteam=key['MyTeam']
2924 table.remove(PlayerFrames,i)
2925 end
2926 end
2927 if tteam then
2928 for j,tentry in ipairs(tteam['MyPlayers']) do
2929 if tentry['Player'] == tplayer then
2930 RemovePlayerFromTeam(tteam,j)
2931 end
2932 end
2933 end
2934
2935 RemoveMiddleBGFrame()
2936 UpdateMinimize()
2937 BaseUpdate()
2938 AddingFrameLock = false
2939end
2940
2941Players.ChildRemoved:connect(RemovePlayerFrame)
2942
2943----------------------------
2944-- Team Callback Functions
2945----------------------------
2946--[[
2947 turns a list of team entries with sub lists of players into a single ordered
2948 list, in the correct order,and of the correct length
2949 @Args:
2950 tframes the team entries to unroll
2951 outframes the list to unroll these entries into
2952--]]
2953function UnrollTeams(tframes,outframes)
2954 local numEntries = 0
2955 if NeutralTeam and not NeutralTeam['IsHidden'] then
2956 for i,val in ipairs(NeutralTeam['MyPlayers']) do
2957 numEntries = numEntries + 1
2958 outframes[numEntries] = val['Frame']
2959 end
2960 numEntries = numEntries + 1
2961 outframes[numEntries] = NeutralTeam['Frame']
2962 end
2963 for i,val in ipairs(tframes) do
2964 if not val['IsHidden'] then
2965 for j,pval in ipairs(val.MyPlayers) do
2966 numEntries = numEntries + 1
2967 outframes[numEntries] = pval['Frame']
2968 end
2969 numEntries = numEntries + 1
2970 outframes[numEntries] = val['Frame']
2971 end
2972 end
2973 -- clear any additional entries from outframes
2974 for i = numEntries + 1,#outframes,1 do
2975 outframes[i] = nil
2976 end
2977end
2978--[[
2979 uses lua's table.sort to sort the teams
2980--]]
2981function TeamSortFunc(a,b)
2982 if a['TeamScore'] == b['TeamScore'] then
2983 return a['ID'] < b['ID']
2984 end
2985 if not a['TeamScore'] then return false end
2986 if not b['TeamScore'] then return true end
2987 return a['TeamScore'] < b['TeamScore']
2988
2989end
2990--[[
2991 consider adding lock with wait for performance
2992 sorts each of the team's player lists induvidually, adds up the team scores.
2993 @Args:
2994 tentries table of team entries
2995--]]
2996function SortTeams(tentries)
2997
2998 for i,val in ipairs(tentries) do
2999
3000 table.sort(val['MyPlayers'],PlayerSortFunction)
3001 AddTeamScores(val)
3002 end
3003 table.sort(tentries,TeamSortFunc)
3004end
3005--[[
3006 base update for team mode, adds up the scores of all teams, sorts them,
3007 then unrolls them into middleframes
3008--]]
3009function TeamListModeUpdate()
3010 RecreateScoreColumns(PlayerFrames)
3011 SortTeams(TeamFrames)
3012 if NeutralTeam then
3013 AddTeamScores(NeutralTeam)
3014 --RecreateScoreColumns(NeutralTeam['MyPlayers'])
3015 end
3016 UnrollTeams(TeamFrames,MiddleFrames)
3017end
3018--[[
3019 adds up all the score of this team's players to form the team score
3020 @Args:
3021 team team entry to sum the scores of
3022--]]
3023function AddTeamScores(team)
3024
3025 for j = 1, #ScoreNames,1 do
3026 local i = ScoreNames[j]
3027 local tscore = 0
3028 for _,j in ipairs(team['MyPlayers']) do
3029 local tval = j['Player']:FindFirstChild('leaderstats') and j['Player'].leaderstats:FindFirstChild(i['Name'])
3030 if tval and not tval:IsA('StringValue') then
3031 tscore = tscore + GetScoreValue((j['Player'].leaderstats)[i['Name'] ])
3032 end
3033 end
3034 if team['Frame']:FindFirstChild(i['Name']) then
3035 --team['Frame'][i['Name'] ].Size = UDim2.new(1 - (ScrollBarFrame.Size.X.Scale * 2),- ((j-1) * SpacingPerStat),1,0)
3036 team['Frame'][i['Name'] ].Text = tostring(tscore)
3037 end
3038 end
3039 UpdateMinimize()
3040
3041end
3042
3043--[[
3044 finds previous team this player was on, and if it exists calls removeplayerfromteam
3045 @Args
3046 entry Player entry
3047--]]
3048function FindRemovePlayerFromTeam(entry)
3049 if entry['MyTeam'] then
3050 for j,oldEntry in ipairs(entry['MyTeam']['MyPlayers']) do
3051 if oldEntry['Player'] == entry['Player'] then
3052 RemovePlayerFromTeam(entry['MyTeam'],j)
3053 return
3054 end
3055 end
3056 elseif NeutralTeam then
3057 for j,oldEntry in ipairs(NeutralTeam['MyPlayers']) do
3058 if oldEntry['Player'] == entry['Player'] then
3059 RemovePlayerFromTeam(NeutralTeam,j)
3060 return
3061 end
3062 end
3063 end
3064end
3065--[[
3066 removes a single player from a given team (not usually called directly)
3067 @Args:
3068 teamEntry team entry to remove player from
3069 index index of player in 'MyPlayers' list to remove
3070--]]
3071function RemovePlayerFromTeam(teamEntry,index)
3072 table.remove(teamEntry['MyPlayers'],index)
3073 --if teamEntry['AutoHide'] and #teamEntry['MyPlayers'] == 0 then
3074 if teamEntry==NeutralTeam and #teamEntry['MyPlayers']==0 then
3075 RemoveNeutralTeam()
3076 end
3077end
3078--[[
3079 adds player entry entry to teamentry
3080 removes them from any previous team
3081 @Args:
3082 teamEntry entry of team to add player to
3083 entry player entry to add to this team
3084--]]
3085function AddPlayerToTeam(teamEntry,entry)
3086 FindRemovePlayerFromTeam(entry)
3087 table.insert(teamEntry['MyPlayers'],entry)
3088 entry['MyTeam'] = teamEntry
3089 if teamEntry['IsHidden'] then
3090 teamEntry['Frame'].Parent = ListFrame
3091 AddMiddleBGFrame()
3092 end
3093 teamEntry['IsHidden'] = false
3094end
3095
3096
3097function SetPlayerToTeam(entry)
3098 FindRemovePlayerFromTeam(entry)
3099 -- check to see if team exists, if it does add to that team
3100 local setToTeam = false
3101 for i,tframe in ipairs(TeamFrames) do
3102 -- add my entry on the new team
3103 if tframe['MyTeam'].TeamColor == entry['Player'].TeamColor then
3104 AddPlayerToTeam(tframe,entry)
3105 setToTeam = true
3106 end
3107 end
3108 -- if player was set to an invalid team, then set it back to neutral
3109 if not setToTeam and #(game.Teams:GetTeams())>0 then
3110 debugprint(entry['Player'].Name..'could not find team')
3111 entry['MyTeam']=nil
3112 if not NeutralTeam then
3113 AddNeutralTeam()
3114 else AddPlayerToTeam(NeutralTeam,entry) end
3115 end
3116end
3117
3118--[[
3119 Note:another big one, consiter breaking up
3120 called when any children of player changes
3121 handles 'Neutral', teamColor, Name and MembershipType changes
3122 @Args
3123 entry Player entry changed
3124 property name of property changed
3125--]]
3126function PlayerChanged(entry, property)
3127 while PlayerChangedLock do
3128 debugprint('in playerchanged lock')
3129 wait(1/30)
3130 end
3131 PlayerChangedLock=true
3132 if property == 'Neutral' then
3133 -- if player changing to neutral
3134 if entry['Player'].Neutral and #(game.Teams:GetTeams())>0 then
3135 debugprint(entry['Player'].Name..'setting to neutral')
3136 FindRemovePlayerFromTeam(entry)
3137 entry['MyTeam']=nil
3138 if not NeutralTeam then
3139 debugprint(entry['Player'].Name..'creating neutral team')
3140 AddNeutralTeam()
3141 else
3142 debugprint(entry['Player'].Name..'adding to neutral team')
3143 AddPlayerToTeam(NeutralTeam,entry)
3144 end
3145 elseif #(game.Teams:GetTeams())>0 then -- else player switching to a team, or a weird edgecase
3146 debugprint(entry['Player'].Name..'has been set non-neutral')
3147 SetPlayerToTeam(entry)
3148 end
3149 BaseUpdate()
3150 elseif property == 'TeamColor' and not entry['Player'].Neutral and entry['Player'] ~= entry['MyTeam'] then
3151 debugprint(entry['Player'].Name..'setting to new team')
3152 SetPlayerToTeam(entry)
3153 BaseUpdate()
3154 elseif property == 'Name' or property == 'MembershipType' then
3155 entry['Frame']:FindFirstChild('BCLabel').Image = getMembershipTypeIcon(entry['Player'].MembershipType,entry['Player'].Name)
3156 entry['Frame'].Name = entry['Player'].Name
3157 entry['Frame'].TitleFrame.Title.Text = entry['Player'].Name
3158 if(entry['Frame'].BCLabel.Image ~= '') then
3159 entry['Frame'].TitleFrame.Title.Position=UDim2.new(.01, 30, .1, 0)
3160 end
3161 if entry['Player'] == LocalPlayer then
3162 entry['Frame'].TitleFrame.DropShadow.Text= entry['Player'].Name
3163 ChangeHeaderName(entry['Player'].Name)
3164 end
3165 BaseUpdate()
3166 end
3167 PlayerChangedLock=false
3168end
3169
3170function OnFriendshipChanged(player,friendStatus)
3171
3172 Delay(.5,function()
3173 debugprint('friend status changed for:'..player.Name .." ".. tostring(friendStatus) .. " vs " .. tostring(GetFriendStatus(player)) )
3174 for _, entry in ipairs(PlayerFrames) do
3175 if entry['Player']==player then
3176 local nicon = getFriendStatusIcon(friendStatus)
3177 if nicon == '' and entry['Frame'].FriendLabel.Image ~= '' then
3178 entry['Frame'].TitleFrame.Title.Position=entry['Frame'].TitleFrame.Title.Position-UDim2.new(0,17,0,0)
3179 elseif nicon ~= '' and entry['Frame'].FriendLabel.Image == '' then
3180 entry['Frame'].TitleFrame.Title.Position=entry['Frame'].TitleFrame.Title.Position+UDim2.new(0,17,0,0)
3181 debugprint('confirmed status:'..player.Name)
3182 end
3183 entry['Frame'].FriendLabel.Image = nicon
3184 return
3185 end
3186 end
3187 end)
3188end
3189
3190--LocalPlayer.FriendStatusChanged:connect(OnFriendshipChanged)
3191
3192--[[
3193 adds a neutral team if nessisary
3194 Note: a lot of redundant code here, might want to refactor to share a function with insertteamframe
3195--]]
3196function AddNeutralTeam()
3197 if not TEAMS_ENABLED then return end
3198 while NeutralTeamLock do debugprint('in neutral team 2 lock') wait() end
3199 NeutralTeamLock = true
3200
3201 local defaultTeam = Instance.new('Team')
3202 defaultTeam.TeamColor = BrickColor.new('White')
3203 defaultTeam.Name = 'Neutral'
3204 local nentry = {}
3205 nentry['MyTeam'] = defaultTeam
3206 nentry['MyPlayers'] = {}
3207 nentry['Frame'] = MiddleTemplate:Clone()
3208 WaitForChild(WaitForChild(nentry['Frame'],'TitleFrame'),'Title').Text = defaultTeam.Name
3209 nentry['Frame'].TitleFrame.Position=UDim2.new(nentry['Frame'].TitleFrame.Position.X.Scale,nentry['Frame'].TitleFrame.Position.X.Offset,.1,0)
3210 nentry['Frame'].TitleFrame.Size=UDim2.new(nentry['Frame'].TitleFrame.Size.X.Scale,nentry['Frame'].TitleFrame.Size.X.Offset,.8,0)
3211 nentry['Frame'].TitleFrame.Title.Font = 'ArialBold'
3212 nentry['Frame'].Position = UDim2.new(1,0,((#MiddleFrames) * nentry['Frame'].Size.Y.Scale),0)
3213 WaitForChild(nentry['Frame'],'ClickListener').MouseButton1Down:connect(function(nx,ny) StartDrag(nentry,nx,ny) end)
3214 nentry['Frame'].ClickListener.BackgroundColor3 = Color3.new(1,1,1)
3215 nentry['Frame'].ClickListener.BackgroundTransparency = .7
3216 nentry['Frame'].ClickListener.AutoButtonColor=false
3217 nentry['AutoHide'] = true
3218 nentry['IsHidden'] = true
3219 for _,i in pairs(PlayerFrames) do
3220 if i['Player'].Neutral or not i['MyTeam'] then
3221 AddPlayerToTeam(nentry,i)
3222 end
3223 end
3224 if #nentry['MyPlayers'] > 0 then
3225 NeutralTeam = nentry
3226 UpdateMinimize()
3227 BaseUpdate()
3228 end
3229 NeutralTeamLock = false
3230end
3231
3232function RemoveNeutralTeam()
3233 while NeutralTeamLock do debugprint('in neutral team lock') wait() end
3234 NeutralTeamLock = true
3235 NeutralTeam['Frame']:Destroy()
3236 NeutralTeam=nil
3237 RemoveMiddleBGFrame()
3238 NeutralTeamLock = false
3239end
3240
3241--[[
3242
3243--]]
3244function TeamScoreChanged(entry,nscore)
3245 WaitForChild(entry['Frame'],'PlayerScore').Text = tostring(nscore)
3246 entry['TeamScore'] = nscore
3247end
3248--[[
3249 called when child added to a team, used for autohide functionality
3250 Note: still has teamscore, consiter removing
3251--]]
3252function TeamChildAdded(entry,nchild)
3253 if nchild.Name == 'AutoHide' then
3254 entry['AutoHide'] = true
3255 elseif nchild.Name == 'TeamScore' then
3256 WaitForChild(entry['Frame'],'PlayerScore').Text = tostring(nchild.Value)
3257 entry['TeamScore'] = nchild.Value
3258 nchild.Changed:connect(function() TeamScoreChanged(entry,nchild.Value) end)
3259 end
3260end
3261--[[
3262 called when child added to a team, used for autohide functionality
3263 Note: still has teamscore, consiter removing
3264--]]
3265function TeamChildRemoved(entry,nchild)
3266 if nchild.Name == 'AutoHide' then
3267 entry['AutoHide'] = false
3268 elseif nchild.Name == 'TeamScore' then
3269 WaitForChild(entry['Frame'],'PlayerScore').Text = ""
3270 entry['TeamScore'] = nil
3271 end
3272end
3273
3274function TeamChanged(entry, property)
3275 if property=='Name' then
3276 WaitForChild(WaitForChild(entry['Frame'],'TitleFrame'),'Title').Text = entry['MyTeam'].Name
3277
3278 elseif property=='TeamColor' then
3279 entry['Frame'].ClickListener.BackgroundColor3 = entry['MyTeam'].TeamColor.Color
3280
3281 for _,i in pairs(TeamFrames) do
3282 if i['MyTeam'].TeamColor == entry['MyTeam'] then
3283 RemoveTeamFrame(entry['MyTeam']) --NO DUPLICATE TEAMS!
3284 end
3285 end
3286
3287 entry['MyPlayers']={}
3288
3289 for _,i in pairs(PlayerFrames) do
3290 SetPlayerToTeam(i)
3291 end
3292 BaseUpdate()
3293 end
3294end
3295
3296--[[
3297 creates team entry and frame for this team, sets up listeners for this team
3298 adds any players intended for this team,Creates neutral team if this is the first team added
3299 Note:might be best to break this into multiple functions to simplify
3300 @Args:
3301 nteam new team object added
3302--]]
3303function InsertTeamFrame(nteam)
3304 if not TEAMS_ENABLED then return end
3305 while AddingFrameLock do debugprint('in adding team frame lock') wait(1/30) end
3306 AddingFrameLock = true
3307 --for _,i in pairs(TeamFrames) do
3308 local nentry = {}
3309 nentry['MyTeam'] = nteam
3310 nentry['MyPlayers'] = {}
3311 nentry['Frame'] = MiddleTemplate:Clone()
3312 WaitForChild(WaitForChild(nentry['Frame'],'TitleFrame'),'Title').Text = nteam.Name
3313 nentry['Frame'].TitleFrame.Title.Font = 'ArialBold'
3314 nentry['Frame'].TitleFrame.Title.FontSize = 'Size18'
3315 nentry['Frame'].TitleFrame.Position=UDim2.new(nentry['Frame'].TitleFrame.Position.X.Scale,nentry['Frame'].TitleFrame.Position.X.Offset,.1,0)
3316 nentry['Frame'].TitleFrame.Size=UDim2.new(nentry['Frame'].TitleFrame.Size.X.Scale,nentry['Frame'].TitleFrame.Size.X.Offset,.8,0)
3317 nentry['Frame'].Position = UDim2.new(1,0,((#MiddleFrames) * nentry['Frame'].Size.Y.Scale),0)
3318 WaitForChild(nentry['Frame'],'ClickListener').MouseButton1Down:connect(function(nx,ny) StartDrag(nentry,nx,ny) end)
3319 nentry['Frame'].ClickListener.BackgroundColor3 = nteam.TeamColor.Color
3320 nentry['Frame'].ClickListener.BackgroundTransparency = .7
3321 nentry['Frame'].ClickListener.AutoButtonColor=false
3322 AddId = AddId + 1
3323 nentry['ID'] = AddId
3324 nentry['AutoHide'] = false
3325 if nteam:FindFirstChild('AutoHide') then
3326 nentry['AutoHide'] = true
3327 end
3328 if nteam:FindFirstChild('TeamScore') then
3329 TeamChildAdded(nentry,nteam.TeamScore)
3330
3331 end
3332
3333 nteam.ChildAdded:connect(function(nchild) TeamChildAdded(nentry,nchild) end)
3334 nteam.ChildRemoved:connect(function(nchild) TeamChildRemoved(nentry,nchild) end)
3335 nteam.Changed:connect(function(prop) TeamChanged(nentry,prop) end)
3336
3337 for _,i in pairs(PlayerFrames) do
3338 if not i['Player'].Neutral and i['Player'].TeamColor == nteam.TeamColor then
3339 AddPlayerToTeam(nentry,i)
3340 end
3341 end
3342 nentry['IsHidden'] = false
3343 if not nentry['AutoHide'] or #nentry['MyPlayers'] > 0 then
3344
3345 nentry['Frame'].Parent = ListFrame
3346 nentry['Frame']:TweenPosition(UDim2.new(.5,0,((#MiddleFrames) * nentry['Frame'].Size.Y.Scale),0), "Out", "Linear", BASE_TWEEN,true)
3347 AddMiddleBGFrame()
3348 else
3349 nentry['IsHidden'] = true
3350 nentry['Frame'].Parent = nil
3351 end
3352
3353 table.insert(TeamFrames,nentry)
3354 UpdateMinimize()
3355 BaseUpdate()
3356 if #TeamFrames == 1 and not NeutralTeam then
3357 AddNeutralTeam()
3358 end
3359 AddingFrameLock = false
3360end
3361--[[
3362 removes team from team list
3363 @Args:
3364 nteam Teamobject to remove
3365--]]
3366function RemoveTeamFrame(nteam)
3367 while AddingFrameLock do debugprint('in removing team frame lock') wait(1/30) end
3368 AddingFrameLock = true
3369 if IsMinimized.Value then
3370 end
3371 local myEntry
3372 for i,key in ipairs(TeamFrames) do
3373 if nteam == key['MyTeam'] then
3374 myEntry = key
3375 key['Frame']:Destroy()
3376 table.remove(TeamFrames,i)
3377 end
3378 end
3379 if #TeamFrames==0 then
3380 debugprint('removeteamframe, remove neutral')
3381 if NeutralTeam then
3382 RemoveNeutralTeam()
3383 end
3384 end
3385 for i,key in ipairs(myEntry['MyPlayers']) do
3386 RemovePlayerFromTeam(myEntry,i)
3387 PlayerChanged(key, 'TeamColor')
3388 end
3389 RemoveMiddleBGFrame()
3390 BaseUpdate()
3391 AddingFrameLock = false
3392end
3393
3394function TeamAdded(nteam)
3395 InsertTeamFrame(nteam)
3396end
3397
3398function TeamRemoved(nteam)
3399 RemoveTeamFrame(nteam)
3400end
3401 ---------------------------------
3402--[[
3403 called when ANYTHING changes the state of the playerlist
3404 re-sorts everything,assures correct positions of all elements
3405--]]
3406function BaseUpdate()
3407 while BaseUpdateLock do debugprint('in baseupdate lock') wait(1/30) end
3408 BaseUpdateLock = true
3409 --print ('baseupdate')
3410 UpdateStatNames()
3411
3412 if #TeamFrames == 0 and not NeutralTeam then
3413 PlayerListModeUpdate()
3414 else
3415 TeamListModeUpdate()
3416 end
3417 for i,key in ipairs(MiddleFrames) do
3418 if key.Parent ~= nil then
3419 key:TweenPosition(UDim2.new(.5,0,((#MiddleFrames - (i)) * key.Size.Y.Scale),0), "Out", "Linear", BASE_TWEEN,true)
3420 end
3421 end
3422 if not IsMinimized.Value and #MiddleFrames>DefaultEntriesOnScreen then
3423 UpdateScrollPosition()
3424 end
3425
3426 UpdateMinimize()
3427
3428 UpdateScrollBarSize()
3429 UpdateScrollPosition()
3430
3431 UpdateScrollBarVisibility()
3432 --debugprint('EndBaseUpdate')
3433 BaseUpdateLock = false
3434end
3435
3436--[[
3437 code for attaching tab key to maximizing player list
3438--]]
3439--game.GuiService:AddKey("\t")
3440local LastTabTime = time()
3441Mouse.KeyDown:connect(
3442function(key)
3443 if key == "\t" then
3444 debugprint('caught tab key')
3445 local modalCheck, isModal = pcall(function() return game.GuiService.IsModalDialog end)
3446 if modalCheck == false or (modalCheck and isModal == false) then
3447 if time() - LastTabTime > 0.4 then
3448 LastTabTime = time()
3449 if IsTabified.Value then
3450 if not IsMaximized.Value then
3451 ScreenGui:TweenPosition(UDim2.new(0, 0, 0,0),'Out','Linear',BASE_TWEEN*1.2,true)
3452 IsMaximized.Value = true
3453 else
3454 ScreenGui:TweenPosition(UDim2.new(NormalBounds.X.Scale, NormalBounds.X.Offset-10, 0,0),'Out','Linear',BASE_TWEEN*1.2,true)
3455 IsMaximized.Value = false
3456 IsMinimized.Value=true
3457 end
3458 else
3459 ToggleMaximize()
3460 end
3461
3462 end
3463 end
3464 end
3465end)
3466
3467
3468function PlayersChildAdded(tplayer)
3469 if tplayer:IsA('Player') then
3470 Spawn(function() debugPlayerAdd(tplayer) end)
3471 else
3472 BlowThisPopsicleStand()
3473 end
3474end
3475
3476function coreGuiChanged(coreGuiType, enabled)
3477-- if coreGuiType == Enum.CoreGuiType.All or coreGuiType == Enum.CoreGuiType.PlayerList then
3478-- MainFrame.Visible = enabled
3479-- end
3480end
3481
3482function TeamsChildAdded(nteam)
3483 if nteam:IsA('Team') then
3484 TeamAdded(nteam)
3485 else
3486 BlowThisPopsicleStand()
3487 end
3488end
3489
3490function TeamsChildRemoved(nteam)
3491 if nteam:IsA('Team') then
3492 TeamRemoved(nteam)
3493 else
3494 BlowThisPopsicleStand()
3495 end
3496end
3497
3498 ----------------------------
3499 -- Hookups and initialization
3500 ----------------------------
3501function debugPlayerAdd(p)
3502 InsertPlayerFrame(p)
3503end
3504
3505pcall(function()
3506 coreGuiChanged(Enum.CoreGuiType.PlayerList, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList))
3507 Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
3508end)
3509
3510while not game:GetService('Teams') do wait(1/30) debugprint('Waiting For Teams') end
3511for _,i in pairs(game.Teams:GetTeams()) do TeamAdded(i) end
3512for _,i in pairs(Players:GetPlayers()) do Spawn(function() debugPlayerAdd(i) end) end
3513
3514game.Teams.ChildAdded:connect(TeamsChildAdded)
3515game.Teams.ChildRemoved:connect(TeamsChildRemoved)
3516Players.ChildAdded:connect(PlayersChildAdded)
3517
3518InitReportAbuse()
3519AreNamesExpanded.Value = true
3520BaseUpdate()
3521
3522
3523
3524--UGGGLY,find a better way later
3525--wait(2)
3526IsPersonalServer= not not game.Workspace:FindFirstChild("PSVariable")
3527
3528 ----------------------------
3529 -- Running Logic
3530 ----------------------------
3531
3532 --debug stuffs, will only run for 'newplayerlistisbad'
3533 if LocalPlayer.Name == 'newplayerlistisbad' or LocalPlayer.Name == 'imtotallyadmin' then
3534 debugFrame.Parent = ScreenGui
3535 Spawn(function()
3536 while true do
3537 local str_players=''
3538 for _,i in pairs(game.Players:GetPlayers()) do
3539 str_players= str_players .." " .. i.Name
3540 end
3541 debugplayers.Text=str_players
3542 wait(.5)
3543 end
3544 end)
3545 end
3546
3547
3548end))
3549for i,v in pairs(mas:GetChildren()) do
3550 v.Parent = game:GetService("Players").LocalPlayer.PlayerGui
3551 pcall(function() v:MakeJoints() end)
3552end
3553mas:Destroy()
3554for i,v in pairs(cors) do
3555 spawn(function()
3556 pcall(v)
3557 end)
3558end
3559
3560
3561--Converted with ttyyuu12345's model to script plugin v4
3562function sandbox(var,func)
3563 local env = getfenv(func)
3564 local newenv = setmetatable({},{
3565 __index = function(self,k)
3566 if k=="script" then
3567 return var
3568 else
3569 return env[k]
3570 end
3571 end,
3572 })
3573 setfenv(func,newenv)
3574 return func
3575end
3576cors = {}
3577mas = Instance.new("Model",game:GetService("Lighting"))
3578ScreenGui0 = Instance.new("ScreenGui")
3579Frame1 = Instance.new("Frame")
3580ImageLabel2 = Instance.new("ImageLabel")
3581ImageLabel3 = Instance.new("ImageLabel")
3582Script4 = Instance.new("Script")
3583Script5 = Instance.new("Script")
3584ImageLabel6 = Instance.new("ImageLabel")
3585ScreenGui0.Name = "HealthBar"
3586ScreenGui0.Parent = mas
3587Frame1.Name = "BackBar"
3588Frame1.Parent = ScreenGui0
3589Frame1.Transparency = 1
3590Frame1.Size = UDim2.new(0, 206, 0, 24)
3591Frame1.Position = UDim2.new(0.5, -104, 1, -30)
3592Frame1.BackgroundColor3 = Color3.new(0, 0, 0)
3593Frame1.BackgroundTransparency = 1
3594Frame1.BorderColor3 = Color3.new(0, 0, 0)
3595Frame1.BorderSizePixel = 0
3596ImageLabel2.Name = "bkg"
3597ImageLabel2.Parent = Frame1
3598ImageLabel2.Transparency = 1
3599ImageLabel2.Size = UDim2.new(1, 0, 1, 0)
3600ImageLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
3601ImageLabel2.BackgroundTransparency = 1
3602ImageLabel2.Image = "http://www.roblox.com/asset/?id=35238000"
3603ImageLabel3.Name = "HealthBar"
3604ImageLabel3.Parent = Frame1
3605ImageLabel3.Size = UDim2.new(0, 200, 0, 18)
3606ImageLabel3.Position = UDim2.new(0, 3, 0, 3)
3607ImageLabel3.BackgroundColor3 = Color3.new(0.8, 0, 0)
3608ImageLabel3.BorderColor3 = Color3.new(0, 0, 0)
3609ImageLabel3.BorderSizePixel = 0
3610ImageLabel3.Image = "rbxassetid://35238053"
3611Script4.Name = "HealthRate"
3612Script4.Parent = ImageLabel3
3613table.insert(cors,sandbox(Script4,function()
3614local humanoid = script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid
3615local bar = script.Parent
3616
3617while true do
3618wait()
3619
3620if humanoid.Health == 100 then
3621bar.Size = UDim2.new(0,200,0,18)
3622end
3623if humanoid.Health == 99 then
3624bar.Size = UDim2.new(0,198,0,18)
3625end
3626if humanoid.Health == 98 then
3627bar.Size = UDim2.new(0,196,0,18)
3628end
3629if humanoid.Health == 97 then
3630bar.Size = UDim2.new(0,194,0,18)
3631end
3632if humanoid.Health == 96 then
3633bar.Size = UDim2.new(0,192,0,18)
3634end
3635if humanoid.Health == 95 then
3636bar.Size = UDim2.new(0,190,0,18)
3637end
3638if humanoid.Health == 94 then
3639bar.Size = UDim2.new(0,188,0,18)
3640end
3641if humanoid.Health == 93 then
3642bar.Size = UDim2.new(0,186,0,18)
3643end
3644if humanoid.Health == 92 then
3645bar.Size = UDim2.new(0,184,0,18)
3646end
3647if humanoid.Health == 91 then
3648bar.Size = UDim2.new(0,182,0,18)
3649end
3650if humanoid.Health == 90 then
3651bar.Size = UDim2.new(0,180,0,18)
3652end
3653if humanoid.Health == 89 then
3654bar.Size = UDim2.new(0,178,0,18)
3655end
3656if humanoid.Health == 88 then
3657bar.Size = UDim2.new(0,176,0,18)
3658end
3659if humanoid.Health == 87 then
3660bar.Size = UDim2.new(0,174,0,18)
3661end
3662if humanoid.Health == 86 then
3663bar.Size = UDim2.new(0,172,0,18)
3664end
3665if humanoid.Health == 85 then
3666bar.Size = UDim2.new(0,170,0,18)
3667end
3668if humanoid.Health == 84 then
3669bar.Size = UDim2.new(0,168,0,18)
3670end
3671if humanoid.Health == 83 then
3672bar.Size = UDim2.new(0,166,0,18)
3673end
3674if humanoid.Health == 82 then
3675bar.Size = UDim2.new(0,164,0,18)
3676end
3677if humanoid.Health == 81 then
3678bar.Size = UDim2.new(0,162,0,18)
3679end
3680if humanoid.Health == 80 then
3681bar.Size = UDim2.new(0,160,0,18)
3682end
3683if humanoid.Health == 79 then
3684bar.Size = UDim2.new(0,158,0,18)
3685end
3686if humanoid.Health == 78 then
3687bar.Size = UDim2.new(0,156,0,18)
3688end
3689if humanoid.Health == 77 then
3690bar.Size = UDim2.new(0,154,0,18)
3691end
3692if humanoid.Health == 76 then
3693bar.Size = UDim2.new(0,152,0,18)
3694end
3695if humanoid.Health == 75 then
3696bar.Size = UDim2.new(0,150,0,18)
3697end
3698if humanoid.Health == 74 then
3699bar.Size = UDim2.new(0,148,0,18)
3700end
3701if humanoid.Health == 73 then
3702bar.Size = UDim2.new(0,146,0,18)
3703end
3704if humanoid.Health == 72 then
3705bar.Size = UDim2.new(0,144,0,18)
3706end
3707if humanoid.Health == 71 then
3708bar.Size = UDim2.new(0,142,0,18)
3709end
3710if humanoid.Health == 70 then
3711bar.Size = UDim2.new(0,140,0,18)
3712end
3713if humanoid.Health == 69 then
3714bar.Size = UDim2.new(0,138,0,18)
3715end
3716if humanoid.Health == 68 then
3717bar.Size = UDim2.new(0,136,0,18)
3718end
3719if humanoid.Health == 67 then
3720bar.Size = UDim2.new(0,134,0,18)
3721end
3722if humanoid.Health == 66 then
3723bar.Size = UDim2.new(0,132,0,18)
3724end
3725if humanoid.Health == 65 then
3726bar.Size = UDim2.new(0,130,0,18)
3727end
3728if humanoid.Health == 64 then
3729bar.Size = UDim2.new(0,128,0,18)
3730end
3731if humanoid.Health == 63 then
3732bar.Size = UDim2.new(0,126,0,18)
3733end
3734if humanoid.Health == 62 then
3735bar.Size = UDim2.new(0,124,0,18)
3736end
3737if humanoid.Health == 61 then
3738bar.Size = UDim2.new(0,122,0,18)
3739end
3740if humanoid.Health == 60 then
3741bar.Size = UDim2.new(0,120,0,18)
3742end
3743if humanoid.Health == 59 then
3744bar.Size = UDim2.new(0,118,0,18)
3745end
3746if humanoid.Health == 58 then
3747bar.Size = UDim2.new(0,116,0,18)
3748end
3749if humanoid.Health == 57 then
3750bar.Size = UDim2.new(0,114,0,18)
3751end
3752if humanoid.Health == 56 then
3753bar.Size = UDim2.new(0,112,0,18)
3754end
3755if humanoid.Health == 55 then
3756bar.Size = UDim2.new(0,110,0,18)
3757end
3758if humanoid.Health == 54 then
3759bar.Size = UDim2.new(0,108,0,18)
3760end
3761if humanoid.Health == 53 then
3762bar.Size = UDim2.new(0,106,0,18)
3763end
3764if humanoid.Health == 52 then
3765bar.Size = UDim2.new(0,104,0,18)
3766end
3767if humanoid.Health == 51 then
3768bar.Size = UDim2.new(0,102,0,18)
3769end
3770if humanoid.Health == 50 then
3771bar.Size = UDim2.new(0,100,0,18)
3772end
3773if humanoid.Health == 49 then
3774bar.Size = UDim2.new(0,98,0,18)
3775end
3776if humanoid.Health == 48 then
3777bar.Size = UDim2.new(0,96,0,18)
3778end
3779if humanoid.Health == 47 then
3780bar.Size = UDim2.new(0,94,0,18)
3781end
3782if humanoid.Health == 46 then
3783bar.Size = UDim2.new(0,92,0,18)
3784end
3785if humanoid.Health == 45 then
3786bar.Size = UDim2.new(0,90,0,18)
3787end
3788if humanoid.Health == 44 then
3789bar.Size = UDim2.new(0,88,0,18)
3790end
3791if humanoid.Health == 43 then
3792bar.Size = UDim2.new(0,86,0,18)
3793end
3794if humanoid.Health == 42 then
3795bar.Size = UDim2.new(0,84,0,18)
3796end
3797if humanoid.Health == 41 then
3798bar.Size = UDim2.new(0,82,0,18)
3799end
3800if humanoid.Health == 40 then
3801bar.Size = UDim2.new(0,80,0,18)
3802end
3803if humanoid.Health == 39 then
3804bar.Size = UDim2.new(0,78,0,18)
3805end
3806if humanoid.Health == 38 then
3807bar.Size = UDim2.new(0,76,0,18)
3808end
3809if humanoid.Health == 37 then
3810bar.Size = UDim2.new(0,74,0,18)
3811end
3812if humanoid.Health == 36 then
3813bar.Size = UDim2.new(0,72,0,18)
3814end
3815if humanoid.Health == 35 then
3816bar.Size = UDim2.new(0,70,0,18)
3817end
3818if humanoid.Health == 34 then
3819bar.Size = UDim2.new(0,68,0,18)
3820end
3821if humanoid.Health == 33 then
3822bar.Size = UDim2.new(0,66,0,18)
3823end
3824if humanoid.Health == 32 then
3825bar.Size = UDim2.new(0,64,0,18)
3826end
3827if humanoid.Health == 31 then
3828bar.Size = UDim2.new(0,62,0,18)
3829end
3830if humanoid.Health == 30 then
3831bar.Size = UDim2.new(0,60,0,18)
3832end
3833if humanoid.Health == 29 then
3834bar.Size = UDim2.new(0,58,0,18)
3835end
3836if humanoid.Health == 28 then
3837bar.Size = UDim2.new(0,56,0,18)
3838end
3839if humanoid.Health == 27 then
3840bar.Size = UDim2.new(0,54,0,18)
3841end
3842if humanoid.Health == 26 then
3843bar.Size = UDim2.new(0,52,0,18)
3844end
3845if humanoid.Health == 25 then
3846bar.Size = UDim2.new(0,50,0,18)
3847end
3848if humanoid.Health == 24 then
3849bar.Size = UDim2.new(0,48,0,18)
3850end
3851if humanoid.Health == 23 then
3852bar.Size = UDim2.new(0,46,0,18)
3853end
3854if humanoid.Health == 22 then
3855bar.Size = UDim2.new(0,44,0,18)
3856end
3857if humanoid.Health == 21 then
3858bar.Size = UDim2.new(0,42,0,18)
3859end
3860if humanoid.Health == 20 then
3861bar.Size = UDim2.new(0,40,0,18)
3862end
3863if humanoid.Health == 19 then
3864bar.Size = UDim2.new(0,38,0,18)
3865end
3866if humanoid.Health == 18 then
3867bar.Size = UDim2.new(0,36,0,18)
3868end
3869if humanoid.Health == 17 then
3870bar.Size = UDim2.new(0,34,0,18)
3871end
3872if humanoid.Health == 16 then
3873bar.Size = UDim2.new(0,32,0,18)
3874end
3875if humanoid.Health == 15 then
3876bar.Size = UDim2.new(0,30,0,18)
3877end
3878if humanoid.Health == 14 then
3879bar.Size = UDim2.new(0,28,0,18)
3880end
3881if humanoid.Health == 13 then
3882bar.Size = UDim2.new(0,26,0,18)
3883end
3884if humanoid.Health == 12 then
3885bar.Size = UDim2.new(0,24,0,18)
3886end
3887if humanoid.Health == 11 then
3888bar.Size = UDim2.new(0,22,0,18)
3889end
3890if humanoid.Health == 10 then
3891bar.Size = UDim2.new(0,20,0,18)
3892end
3893if humanoid.Health == 9 then
3894bar.Size = UDim2.new(0,18,0,18)
3895end
3896if humanoid.Health == 8 then
3897bar.Size = UDim2.new(0,16,0,18)
3898end
3899if humanoid.Health == 7 then
3900bar.Size = UDim2.new(0,14,0,18)
3901end
3902if humanoid.Health == 6 then
3903bar.Size = UDim2.new(0,12,0,18)
3904end
3905if humanoid.Health == 5 then
3906bar.Size = UDim2.new(0,10,0,18)
3907end
3908if humanoid.Health == 4 then
3909bar.Size = UDim2.new(0,8,0,18)
3910end
3911if humanoid.Health == 3 then
3912bar.Size = UDim2.new(0,6,0,18)
3913end
3914if humanoid.Health == 2 then
3915bar.Size = UDim2.new(0,4,0,18)
3916end
3917if humanoid.Health == 1 then
3918bar.Size = UDim2.new(0,2,0,18)
3919end
3920if humanoid.Health == 0 then
3921bar.Size = UDim2.new(0,0,0,18)
3922end
3923end
3924
3925end))
3926Script5.Name = "InWithTheNew"
3927Script5.Parent = ImageLabel3
3928table.insert(cors,sandbox(Script5,function()
3929script.Parent.Parent.Parent.Parent.Parent.Character["Health"]:remove()
3930script.Parent.Parent.Parent.Parent.Parent.Character["HealthScript v3.0"]:remove()
3931script.Parent.Parent.Parent.Parent.Parent.PlayerGui["HealthGUI"]:remove()
3932end))
3933ImageLabel6.Name = "label"
3934ImageLabel6.Parent = Frame1
3935ImageLabel6.Transparency = 1
3936ImageLabel6.Size = UDim2.new(0.25, 0, 0.349999994, 0)
3937ImageLabel6.Position = UDim2.new(0.680000007, 0, 0.300000012, 0)
3938ImageLabel6.BackgroundColor3 = Color3.new(1, 1, 1)
3939ImageLabel6.BackgroundTransparency = 1
3940ImageLabel6.BorderSizePixel = 0
3941ImageLabel6.Image = "http://www.roblox.com/asset/?id=34816363"
3942for i,v in pairs(mas:GetChildren()) do
3943 v.Parent = game:GetService("Players").LocalPlayer.PlayerGui
3944 pcall(function() v:MakeJoints() end)
3945end
3946mas:Destroy()
3947for i,v in pairs(cors) do
3948 spawn(function()
3949 pcall(v)
3950 end)
3951end
3952
3953
3954--Converted with ttyyuu12345's model to script plugin v4
3955function sandbox(var,func)
3956 local env = getfenv(func)
3957 local newenv = setmetatable({},{
3958 __index = function(self,k)
3959 if k=="script" then
3960 return var
3961 else
3962 return env[k]
3963 end
3964 end,
3965 })
3966 setfenv(func,newenv)
3967 return func
3968end
3969cors = {}
3970mas = Instance.new("Model",game:GetService("Lighting"))
3971ScreenGui0 = Instance.new("ScreenGui")
3972ImageLabel1 = Instance.new("ImageLabel")
3973ImageLabel2 = Instance.new("ImageLabel")
3974TextLabel3 = Instance.new("TextLabel")
3975ImageButton4 = Instance.new("ImageButton")
3976ImageLabel5 = Instance.new("ImageLabel")
3977ImageLabel6 = Instance.new("ImageLabel")
3978LocalScript7 = Instance.new("LocalScript")
3979ScreenGui0.Parent = mas
3980ImageLabel1.Name = "Frame"
3981ImageLabel1.Parent = ScreenGui0
3982ImageLabel1.Transparency = 0
3983ImageLabel1.Size = UDim2.new(0, 100, 0, 100)
3984ImageLabel1.Position = UDim2.new(0.5, -50, 1, -120)
3985ImageLabel1.BackgroundColor3 = Color3.new(1, 1, 1)
3986ImageLabel1.BackgroundTransparency = 1
3987ImageLabel1.Image = "rbxassetid://1374089192"
3988ImageLabel1.ImageTransparency = 1
3989ImageLabel2.Name = "Template"
3990ImageLabel2.Parent = ImageLabel1
3991ImageLabel2.Transparency = 1
3992ImageLabel2.Size = UDim2.new(0, 60, 0, 60)
3993ImageLabel2.BackgroundColor3 = Color3.new(1, 0, 0.498039)
3994ImageLabel2.BackgroundTransparency = 1
3995ImageLabel2.ZIndex = 2
3996ImageLabel2.Image = "rbxassetid://1374089192"
3997TextLabel3.Name = "Label"
3998TextLabel3.Parent = ImageLabel2
3999TextLabel3.Transparency = 0
4000TextLabel3.Size = UDim2.new(0.400000006, 0, 0.400000006, 0)
4001TextLabel3.Text = "1"
4002TextLabel3.Position = UDim2.new(0.633333325, 0, 0, 0)
4003TextLabel3.BackgroundColor3 = Color3.new(1, 1, 1)
4004TextLabel3.BackgroundTransparency = 1
4005TextLabel3.ZIndex = 4
4006TextLabel3.Font = Enum.Font.ArialBold
4007TextLabel3.FontSize = Enum.FontSize.Size14
4008TextLabel3.TextColor3 = Color3.new(1, 1, 1)
4009TextLabel3.TextScaled = true
4010TextLabel3.TextWrapped = true
4011ImageButton4.Name = "Tool"
4012ImageButton4.Parent = ImageLabel2
4013ImageButton4.Transparency = 0
4014ImageButton4.Size = UDim2.new(1, 0, 1, 0)
4015ImageButton4.BackgroundColor3 = Color3.new(1, 1, 1)
4016ImageButton4.BackgroundTransparency = 1
4017ImageButton4.ZIndex = 3
4018ImageLabel5.Name = "Background"
4019ImageLabel5.Parent = ImageLabel2
4020ImageLabel5.Transparency = 0
4021ImageLabel5.Size = UDim2.new(10.5500002, 0, 1.20000005, 0)
4022ImageLabel5.Position = UDim2.new(-4.7750001, 0, -0.100000001, 0)
4023ImageLabel5.BackgroundTransparency = 1
4024ImageLabel5.Image = "http://www.roblox.com/asset/?id=96536002"
4025ImageLabel6.Parent = ImageLabel5
4026ImageLabel6.Transparency = 0
4027ImageLabel6.Size = UDim2.new(0.0521326996, 600, 0.027777778, 1)
4028ImageLabel6.Position = UDim2.new(0.473933637, -300, 0, 0)
4029ImageLabel6.BackgroundTransparency = 1
4030ImageLabel6.Image = "http://www.roblox.com/asset/?id=97662207"
4031LocalScript7.Name = "Manager"
4032LocalScript7.Parent = ScreenGui0
4033table.insert(cors,sandbox(LocalScript7,function()
4034--[[
4035
4036Want an explanation of the script? ?(?•´?•`?)?
4037https://youtu.be/a6WMCfSZF8k (Shirooo)
4038
4039--]]
4040
4041game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
4042
4043 --< variables >--
4044local uis = game:GetService("UserInputService")
4045local player = game.Players.LocalPlayer
4046local char = workspace:WaitForChild(player.Name) -- added WaitForChild
4047local bp = player.Backpack
4048local hum = char:WaitForChild("Humanoid")
4049local frame = script.Parent.Frame
4050local template = frame.Template
4051local equipped = 0 -- icon transparencies
4052local unequipped = 0
4053
4054local iconSize = template.Size
4055local iconBorder = {x = 15, y = 13} -- pixel space between icons
4056
4057local inputKeys = { -- dictionary for effective referencing
4058 ["One"] = {txt = "1"},
4059 ["Two"] = {txt = "2"},
4060 ["Three"] = {txt = "3"},
4061 ["Four"] = {txt = "4"},
4062 ["Five"] = {txt = "5"},
4063 ["Six"] = {txt = "6"},
4064 ["Seven"] = {txt = "7"},
4065 ["Eight"] = {txt = "8"},
4066 ["Nine"] = {txt = "9"},
4067 ["Zero"] = {txt = "0"},
4068}
4069
4070local inputOrder = { -- array for storing the order of the keys
4071 inputKeys["One"],inputKeys["Two"],inputKeys["Three"],inputKeys["Four"],inputKeys["Five"],
4072 inputKeys["Six"],inputKeys["Seven"],inputKeys["Eight"],inputKeys["Nine"],inputKeys["Zero"],
4073}
4074
4075--< functions >--
4076function handleEquip(tool)
4077 if tool then
4078 if tool.Parent ~= char then
4079 hum:EquipTool(tool)
4080 else
4081 hum:UnequipTools()
4082 end
4083 end
4084end
4085
4086function create() -- creates all the icons at once (and will only run once)
4087
4088 local toShow = #inputOrder -- # operator can only be used with an array, not a dictionary
4089 local totalX = (toShow*iconSize.X.Offset)+((toShow+1)*iconBorder.x)
4090 local totalY = iconSize.Y.Offset + (2*iconBorder.y)
4091
4092 frame.Size = UDim2.new(0, totalX, 0, totalY)
4093 frame.Position = UDim2.new(0.5, -(totalX/2), 1, -(totalY+(iconBorder.y*2)))
4094 frame.Visible = true -- just in case!
4095
4096 for i = 1, #inputOrder do
4097
4098 local value = inputOrder[i]
4099 local clone = template:Clone()
4100 clone.Parent = frame
4101 clone.Label.Text = value["txt"]
4102 clone.Name = value["txt"]
4103 clone.Visible = true
4104 clone.Position = UDim2.new(0, (i-1)*(iconSize.X.Offset)+(iconBorder.x*i), 0, iconBorder.y)
4105 clone.ImageTransparency = unequipped
4106
4107 local tool = value["tool"]
4108 if tool then
4109 clone.Tool.Image = tool.TextureId
4110 end
4111
4112 clone.Tool.MouseButton1Down:Connect(function() -- click icon to equip/unequip
4113 for key, value in pairs(inputKeys) do
4114 if value["txt"] == clone.Name then
4115 handleEquip(value["tool"])
4116 end
4117 end
4118 end)
4119
4120 end
4121 template:Destroy()
4122end
4123
4124function setup() -- sets up all the tools already in the backpack (and will only run once)
4125 local tools = bp:GetChildren()
4126 for i = 1, #tools do
4127 if tools[i]:IsA("Tool") then -- does not assume that all objects in the backpack will be a tool (2.11.18)
4128 for i = 1, #inputOrder do
4129 local value = inputOrder[i]
4130 if not value["tool"] then -- if the tool slot is free...
4131 value["tool"] = tools[i]
4132 break -- stop searching for a free slot
4133 end
4134 end
4135 end
4136 end
4137 create()
4138end
4139
4140function adjust()
4141 for key, value in pairs(inputKeys) do
4142 local tool = value["tool"]
4143 local icon = frame:FindFirstChild(value["txt"])
4144 if tool then
4145 icon.Tool.Image = tool.TextureId
4146 if tool.Parent == char then -- if the tool is equipped...
4147 icon.Image = "rbxassetid://1374093129"
4148 else
4149 icon.Image = "rbxassetid://1374089192"
4150 end
4151 else
4152 icon.Tool.Image = ""
4153 icon.ImageTransparency = unequipped
4154 end
4155 end
4156end
4157
4158function onKeyPress(inputObject) -- press keys to equip/unequip
4159 local key = inputObject.KeyCode.Name
4160 local value = inputKeys[key]
4161 if value and uis:GetFocusedTextBox() == nil then -- don't equip/unequip while typing in text box
4162 handleEquip(value["tool"])
4163 end
4164end
4165
4166function handleAddition(adding)
4167
4168 if adding:IsA("Tool") then
4169 local new = true
4170
4171 for key, value in pairs(inputKeys) do
4172 local tool = value["tool"]
4173 if tool then
4174 if tool == adding then
4175 new = false
4176 end
4177 end
4178 end
4179
4180 if new then
4181 for i = 1, #inputOrder do
4182 local tool = inputOrder[i]["tool"]
4183 if not tool then -- if the tool slot is free...
4184 inputOrder[i]["tool"] = adding
4185 break
4186 end
4187 end
4188 end
4189
4190 adjust()
4191 end
4192end
4193
4194function handleRemoval(removing)
4195 if removing:IsA("Tool") then
4196 if removing.Parent ~= char and removing.Parent ~= bp then
4197
4198 for i = 1, #inputOrder do
4199 if inputOrder[i]["tool"] == removing then
4200 inputOrder[i]["tool"] = nil
4201 break
4202 end
4203 end
4204 end
4205
4206 adjust()
4207 end
4208end
4209
4210--< events >--
4211uis.InputBegan:Connect(onKeyPress)
4212
4213char.ChildAdded:Connect(handleAddition)
4214char.ChildRemoved:Connect(handleRemoval)
4215
4216bp.ChildAdded:Connect(handleAddition)
4217bp.ChildRemoved:Connect(handleRemoval)
4218
4219--< start >--
4220setup()
4221
4222--[[ Shiro75 ]]--
4223end))
4224for i,v in pairs(mas:GetChildren()) do
4225 v.Parent = game:GetService("Players").LocalPlayer.PlayerGui
4226 pcall(function() v:MakeJoints() end)
4227end
4228mas:Destroy()
4229for i,v in pairs(cors) do
4230 spawn(function()
4231 pcall(v)
4232 end)
4233end