Guest User

Untitled

a guest
Oct 11th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.69 KB | None | 0 0
  1. -- Variables:
  2. local LPlayer = game.Players.LocalPlayer
  3. local PlayerCount = #game.Players:GetPlayers()
  4. local Toggled = false
  5. local TeamsState = false
  6. local Mouse = LPlayer:GetMouse()
  7. local connection
  8. local TPTo
  9.  
  10. -- Instances:
  11. local ScreenGui = Instance.new("ScreenGui")
  12. local Frame = Instance.new("Frame")
  13. local Exit = Instance.new("TextButton")
  14. local ScrollingFrame = Instance.new("ScrollingFrame")
  15. local UIListLayout = Instance.new("UIListLayout")
  16. local Toggle = Instance.new("TextButton")
  17. local Open = Instance.new("TextButton")
  18. local Teams = Instance.new("TextButton")
  19.  
  20. --Properties:
  21. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  22. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  23. ScreenGui.ResetOnSpawn = false
  24.  
  25. Frame.Parent = ScreenGui
  26. Frame.BackgroundColor3 = Color3.fromRGB(48, 48, 48)
  27. Frame.BackgroundTransparency = 0.200
  28. Frame.BorderSizePixel = 3
  29. Frame.Position = UDim2.new(0.0347648263, 0, 0.0559440553, 0)
  30. Frame.Size = UDim2.new(0, 315, 0, 209)
  31.  
  32. Exit.Name = "Exit"
  33. Exit.Parent = Frame
  34. Exit.BackgroundColor3 = Color3.fromRGB(121, 121, 121)
  35. Exit.Position = UDim2.new(0.899581671, 0, 0, 0)
  36. Exit.Size = UDim2.new(0, 24, 0, 27)
  37. Exit.Font = Enum.Font.SourceSans
  38. Exit.Text = "X"
  39. Exit.TextColor3 = Color3.fromRGB(0, 0, 0)
  40. Exit.TextSize = 18.000
  41.  
  42. ScrollingFrame.Parent = Frame
  43. ScrollingFrame.Active = true
  44. ScrollingFrame.BackgroundColor3 = Color3.fromRGB(68, 68, 68)
  45. ScrollingFrame.Position = UDim2.new(0.0470941886, 0, 0.0363145657, 0)
  46. ScrollingFrame.Size = UDim2.new(0, 194, 0, 192)
  47.  
  48. UIListLayout.Parent = ScrollingFrame
  49. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  50.  
  51. Open.Name = "Open"
  52. Open.Parent = ScreenGui
  53. Open.BackgroundColor3 = Color3.fromRGB(113, 113, 113)
  54. Open.Position = UDim2.new(0.0340681374, 0, 0.578088582, 0)
  55. Open.Size = UDim2.new(0, 98, 0, 41)
  56. Open.Style = Enum.ButtonStyle.RobloxRoundButton
  57. Open.Font = Enum.Font.Gotham
  58. Open.Text = "Open GUI"
  59. Open.TextColor3 = Color3.fromRGB(0, 0, 0)
  60. Open.TextSize = 17.000
  61. Open.Visible = false
  62.  
  63. Toggle.Name = "Toggle"
  64. Toggle.Parent = Frame
  65. Toggle.BackgroundColor3 = Color3.fromRGB(191, 7, 7)
  66. Toggle.Position = UDim2.new(0.695238173, 0, 0.842105269, 0)
  67. Toggle.Size = UDim2.new(0, 88, 0, 23)
  68. Toggle.Text = "Not Toggled"
  69. Toggle.Font = Enum.Font.SourceSans
  70. Toggle.TextColor3 = Color3.fromRGB(0, 0, 0)
  71. Toggle.TextSize = 14.000
  72. Toggle.TextScaled = true
  73.  
  74. Teams.Name = "Teams"
  75. Teams.Parent = Frame
  76. Teams.BackgroundColor3 = Color3.fromRGB(191, 187, 70)
  77. Teams.Position = UDim2.new(0.695238173, 0, 0.684210539, 0)
  78. Teams.Size = UDim2.new(0, 88, 0, 23)
  79. Teams.Font = Enum.Font.SourceSans
  80. Teams.Text = "Teams Off"
  81. Teams.TextColor3 = Color3.fromRGB(0, 0, 0)
  82. Teams.TextSize = 14.000
  83. Teams.TextScaled = true
  84.  
  85. -- Do stuff now:
  86.  
  87. local function CreateButton(Player)
  88. local TPbutton = Instance.new("TextButton")
  89.  
  90. TPbutton.Name = "PlayerTP"
  91. TPbutton.Parent = ScrollingFrame
  92. TPbutton.BackgroundColor3 = Color3.fromRGB(50, 227, 101)
  93. TPbutton.Position = UDim2.new(0.0551102199, 0, 0.0909091011, 0)
  94. TPbutton.Size = UDim2.new(0, 148, 0, 23)
  95. TPbutton.Text = Player.Name
  96. TPbutton.TextSize = 11.000
  97. end
  98.  
  99. local function RemoveButtons()
  100. for _, gui in pairs(LPlayer.PlayerGui:GetDescendants()) do
  101. if gui.Name == "PlayerTP" then
  102. gui:Destroy()
  103. end
  104. end
  105. end
  106.  
  107. -- Initially create buttons on startup
  108. for _, Player in pairs(game.Players:GetChildren()) do
  109. if Player.Name ~= LPlayer.Name then
  110. CreateButton(Player)
  111. end
  112. end
  113.  
  114. -- Create button for when someone joins
  115. game.Players.PlayerAdded:Connect(function(Player)
  116. if Player.Name ~= LPlayer.Name then
  117. CreateButton(Player)
  118. end
  119. end)
  120.  
  121. -- Remove button when player joins
  122. game.Players.PlayerRemoving:Connect(function(Player)
  123. for _, PlayerGUI in pairs(ScreenGui:GetDescendants()) do
  124. if PlayerGUI.Name == "PlayerTP" then
  125. if PlayerGUI.Text == Player.Name then
  126. PlayerGUI:Destroy()
  127. end
  128. end
  129. end
  130. end)
  131.  
  132. wait()
  133.  
  134. -- Exit
  135. Exit.MouseButton1Click:Connect(function()
  136. Frame.Visible = false
  137. Open.Visible = true
  138. end)
  139.  
  140. -- Open
  141. Open.MouseButton1Click:Connect(function()
  142. Frame.Visible = true
  143. Open.Visible = false
  144. end)
  145.  
  146. -- Tp Toggle
  147. Toggle.MouseButton1Click:Connect(function()
  148. if Toggled == true then
  149. Toggled = false
  150.  
  151. Toggle.Text = "Not Toggled"
  152. Toggle.BackgroundColor3 = Color3.fromRGB(191, 7, 7)
  153. wait()
  154. else
  155. Toggled = true
  156.  
  157. Toggle.Text = "Toggled"
  158. Toggle.BackgroundColor3 = Color3.fromRGB(75, 227, 0)
  159. wait()
  160. end
  161. end)
  162.  
  163. -- Teams Toggle
  164. Teams.MouseButton1Click:Connect(function()
  165. if TeamsState == false then
  166. TeamsState = true
  167.  
  168. RemoveButtons()
  169.  
  170. for _, plr in pairs(game.Players:GetPlayers()) do
  171. if plr.Team.Name ~= LPlayer.Team.Name then
  172. CreateButton(plr)
  173. end
  174. end
  175.  
  176. Teams.Text = "TP Other Teams"
  177. wait()
  178. else
  179. TeamsState = false
  180.  
  181. RemoveButtons()
  182.  
  183. for _, Player in pairs(game.Players:GetPlayers()) do
  184. if Player.Name ~= LPlayer.Name then
  185. CreateButton(Player)
  186. end
  187. end
  188.  
  189. Teams.Text = "TP All"
  190. wait()
  191. end
  192. end)
  193.  
  194. game:GetService("RunService").Heartbeat:Connect(function()
  195.  
  196. local Guis = LPlayer.PlayerGui:GetGuiObjectsAtPosition(Mouse.X, Mouse.Y)
  197.  
  198. -- Button Click Stuff
  199. for _, gui in pairs(Guis) do
  200. if gui:IsA("GuiButton") then
  201. if gui.Name == "PlayerTP" then
  202. connection = gui.MouseButton1Click:Connect(function()
  203. TPTo = game.Players:FindFirstChild(gui.Text)
  204. LPlayer.Character.HumanoidRootPart.CFrame = TPTo.Character.HumanoidRootPart.CFrame
  205. connection:Disconnect()
  206. end)
  207. end
  208. end
  209. end
  210.  
  211. -- TP Toggle functionality
  212. if Toggled == true then
  213. if TPTo ~= nil then
  214. LPlayer.Character:WaitForChild("HumanoidRootPart").CFrame = TPTo.Character.HumanoidRootPart.CFrame
  215. end
  216. end
  217. end)
Add Comment
Please, Sign In to add comment