Advertisement
filipaopastebins2134

Untitled

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