Advertisement
RIP_ROBLOXXDDD

Command GUI v2 [ Troll Script Admin ]

Sep 8th, 2024
466
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.49 KB | None | 1 0
  1. -- Creating the main GUI
  2. local gui = Instance.new("ScreenGui")
  3. gui.Name = "CommandsGUI_V2"
  4. gui.Parent = game.Players.LocalPlayer.PlayerGui
  5.  
  6. -- Creating the Admin Frame
  7. local frame = Instance.new("Frame")
  8. frame.Name = "AdminFrame"
  9. frame.Size = UDim2.new(0, 300, 0, 400)
  10. frame.Position = UDim2.new(1, -310, 0.5, -200) -- Positioned at the right corner
  11. frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  12. frame.Active = true
  13. frame.Draggable = true
  14. frame.Parent = gui
  15.  
  16. -- Creating the top label
  17. local topLabel = Instance.new("TextLabel")
  18. topLabel.Size = UDim2.new(1, 0, 0, 50)
  19. topLabel.Position = UDim2.new(0, 0, 0, 0)
  20. topLabel.Text = "Command GUI V2"
  21. topLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  22. topLabel.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  23. topLabel.TextSize = 20 -- Changed to 20
  24. topLabel.Parent = frame
  25.  
  26. -- Creating the close button (X)
  27. local closeButton = Instance.new("TextButton")
  28. closeButton.Size = UDim2.new(0, 40, 0, 40)
  29. closeButton.Position = UDim2.new(1, -45, 0, 5) -- Positioned at the top-right corner
  30. closeButton.Text = "X"
  31. closeButton.TextColor3 = Color3.fromRGB(0, 0, 0) -- Black text
  32. closeButton.TextSize = 21 -- Text size set to 21
  33. closeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red background
  34. closeButton.Parent = frame
  35.  
  36. -- Close button functionality
  37. closeButton.MouseButton1Click:Connect(function()
  38. gui:Destroy() -- Closes the entire GUI
  39. end)
  40.  
  41. -- Creating the command box
  42. local commandBox = Instance.new("TextBox")
  43. commandBox.Size = UDim2.new(1, -20, 0, 50)
  44. commandBox.Position = UDim2.new(0, 10, 0, 60)
  45. commandBox.PlaceholderText = "Type your command"
  46. commandBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  47. commandBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  48. commandBox.TextSize = 20
  49. commandBox.Parent = frame
  50.  
  51. -- Creating the status label
  52. local statusLabel = Instance.new("TextLabel")
  53. statusLabel.Size = UDim2.new(1, -20, 0, 40)
  54. statusLabel.Position = UDim2.new(0, 10, 0, 120)
  55. statusLabel.Text = "Status: Nothing"
  56. statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  57. statusLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  58. statusLabel.TextSize = 20 -- Changed to 20
  59. statusLabel.Parent = frame
  60.  
  61. -- Function to reset the status label after 5 seconds
  62. local function resetStatusLabel()
  63. wait(5)
  64. statusLabel.Text = "Status: Nothing"
  65. end
  66.  
  67. -- Function to find a player by name or handle the "me" command
  68. local function findPlayerByName(name)
  69. if name == "me" then
  70. return game.Players.LocalPlayer
  71. end
  72. for _, player in ipairs(game.Players:GetPlayers()) do
  73. if player.Name == name or player.DisplayName == name then
  74. return player
  75. end
  76. end
  77. return nil
  78. end
  79.  
  80. -- Function to apply a command to all players in the server
  81. local function allPlayers(action)
  82. for _, player in ipairs(game.Players:GetPlayers()) do
  83. action(player)
  84. end
  85. end
  86.  
  87. -- Command Functions
  88.  
  89. -- Ban function for a specific target or "me"
  90. local function banPlayer(targetName)
  91. local target = findPlayerByName(targetName)
  92. if target then
  93. target:Kick("You have been banned by an admin!")
  94. statusLabel.Text = "Status: " .. targetName .. " has been banned."
  95. else
  96. statusLabel.Text = "Status: Player not found."
  97. end
  98. resetStatusLabel()
  99. end
  100.  
  101. -- Ban all players function
  102. local function banAllPlayers()
  103. allPlayers(function(player)
  104. player:Kick("You have been banned by an admin!")
  105. end)
  106. statusLabel.Text = "Status: All players have been banned."
  107. resetStatusLabel()
  108. end
  109.  
  110. -- Kick function for a specific target or "me"
  111. local function kickPlayer(targetName)
  112. local target = findPlayerByName(targetName)
  113. if target then
  114. target:Kick("You have been kicked by an admin!")
  115. statusLabel.Text = "Status: " .. targetName .. " has been kicked."
  116. else
  117. statusLabel.Text = "Status: Player not found."
  118. end
  119. resetStatusLabel()
  120. end
  121.  
  122. -- Kill a player or "me" by removing their Humanoid
  123. local function killPlayer(targetName)
  124. local target = findPlayerByName(targetName)
  125. if target and target.Character and target.Character:FindFirstChild("Humanoid") then
  126. target.Character.Humanoid.Health = 0
  127. statusLabel.Text = "Status: " .. targetName .. " has been killed."
  128. else
  129. statusLabel.Text = "Status: Player or Humanoid not found."
  130. end
  131. resetStatusLabel()
  132. end
  133.  
  134. -- Kill all players function
  135. local function killAllPlayers()
  136. allPlayers(function(player)
  137. if player.Character and player.Character:FindFirstChild("Humanoid") then
  138. player.Character.Humanoid.Health = 0
  139. end
  140. end)
  141. statusLabel.Text = "Status: All players have been killed."
  142. resetStatusLabel()
  143. end
  144.  
  145. -- Jail function to trap a player or "me" in a cell
  146. local function jailPlayer(targetName)
  147. local target = findPlayerByName(targetName)
  148. if target and target.Character then
  149. -- Create a "jail cell" around the player
  150. local jailCell = Instance.new("Part")
  151. jailCell.Size = Vector3.new(10, 10, 10)
  152. jailCell.Anchored = true
  153. jailCell.Position = target.Character.PrimaryPart.Position
  154. jailCell.Parent = workspace
  155.  
  156. statusLabel.Text = "Status: " .. targetName .. " has been jailed."
  157. else
  158. statusLabel.Text = "Status: Player not found."
  159. end
  160. resetStatusLabel()
  161. end
  162.  
  163. -- Unjail function to free a jailed player or "me"
  164. local function unjailPlayer(targetName)
  165. local target = findPlayerByName(targetName)
  166. if target then
  167. -- Remove the jail (Assume it's a part named "Jail")
  168. for _, part in ipairs(workspace:GetChildren()) do
  169. if part:IsA("Part") and part.Name == "Jail" then
  170. part:Destroy()
  171. end
  172. end
  173. statusLabel.Text = "Status: " .. targetName .. " has been unjailed."
  174. else
  175. statusLabel.Text = "Status: Player not found."
  176. end
  177. resetStatusLabel()
  178. end
  179.  
  180. -- Teleport to a target player or "me"
  181. local function gotoPlayer(targetName)
  182. local target = findPlayerByName(targetName)
  183. if target and target.Character then
  184. game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(target.Character.PrimaryPart.CFrame)
  185. statusLabel.Text = "Status: Teleported to " .. targetName
  186. else
  187. statusLabel.Text = "Status: Player not found."
  188. end
  189. resetStatusLabel()
  190. end
  191.  
  192. -- Teleport all players to one target or "me"
  193. local function teleportAllToPlayer(targetName)
  194. local target = findPlayerByName(targetName)
  195. if target and target.Character then
  196. local targetPosition = target.Character.PrimaryPart.Position
  197. allPlayers(function(player)
  198. player.Character:SetPrimaryPartCFrame(CFrame.new(targetPosition))
  199. end)
  200. statusLabel.Text = "Status: All players teleported to " .. targetName
  201. else
  202. statusLabel.Text = "Status: Target player not found."
  203. end
  204. resetStatusLabel()
  205. end
  206.  
  207. -- Command Parsing
  208. commandBox.FocusLost:Connect(function(enterPressed)
  209. if enterPressed then
  210. local input = commandBox.Text
  211. local split = string.split(input, " ")
  212.  
  213. if split[1] == "!ban" then
  214. banPlayer(split[2])
  215. elseif split[1] == "!banall" then
  216. banAllPlayers()
  217. elseif split[1] == "!kick" then
  218. kickPlayer(split[2])
  219. elseif split[1] == "!kill" then
  220. killPlayer(split[2])
  221. elseif split[1] == "!killall" then
  222. killAllPlayers()
  223. elseif split[1] == "!jail" then
  224. jailPlayer(split[2])
  225. elseif split[1] == "!unjail" then
  226. unjailPlayer(split[2])
  227. elseif split[1] == "!goto" then
  228. gotoPlayer(split[2])
  229. elseif split[1] == "!tpall" then
  230. teleportAllToPlayer(split[2])
  231. else
  232. statusLabel.Text = "Status: Unknown command."
  233. end
  234.  
  235. commandBox.Text = ""
  236. end
  237. end)
  238.  
  239. -- Function to give a Boombox tool to the player
  240. local function giveBoombox(player)
  241. local tool = Instance.new("Tool")
  242. tool.Name = "Boombox"
  243. tool.RequiresHandle = false
  244. tool.CanBeDropped = false
  245.  
  246. local remote = Instance.new("RemoteEvent")
  247. remote.Name = "PlaySound"
  248. remote.Parent = tool
  249.  
  250. tool.Activated:Connect(function()
  251. local soundId = "rbxassetid://" .. player.Input -- Assuming the player inputs the sound ID
  252. if soundId then
  253. local sound = Instance.new("Sound", workspace)
  254. sound.SoundId = soundId
  255. sound:Play()
  256. end
  257. end)
  258.  
  259. tool.Parent = player.Backpack
  260. statusLabel.Text = "Status: " .. player.Name .. " received a Boombox."
  261. resetStatusLabel()
  262. end
  263.  
  264. -- Command to give Boombox to player or all
  265. local function giveBoomboxCommand(targetName)
  266. if targetName == "all" then
  267. allPlayers(function(player)
  268. giveBoombox(player)
  269. end)
  270. statusLabel.Text = "Status: All players received a Boombox."
  271. else
  272. local target = findPlayerByName(targetName)
  273. if target then
  274. giveBoombox(target)
  275. else
  276. statusLabel.Text = "Status: Player not found."
  277. end
  278. end
  279. resetStatusLabel()
  280. end
  281.  
  282. -- Handle !boombox command
  283. commandBox.FocusLost:Connect(function(enterPressed)
  284. if enterPressed then
  285. local input = commandBox.Text
  286. local split = string.split(input, " ")
  287.  
  288. if split[1] == "!boombox" then
  289. giveBoomboxCommand(split[2])
  290. end
  291. end
  292. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement