Advertisement
Gax66

Hide Players Script!

Aug 11th, 2024
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.38 KB | None | 0 0
  1. -- Debugging function to print messages
  2. local function debugPrint(message)
  3. print(message)
  4. end
  5.  
  6. -- Function to create the Notification GUI
  7. local function createNotification()
  8. -- Create a new ScreenGui
  9. local screenGui = Instance.new("ScreenGui")
  10. screenGui.Name = "NotificationGui"
  11. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  12. debugPrint("Notification GUI created")
  13.  
  14. -- Create a Frame for the notification
  15. local notificationFrame = Instance.new("Frame")
  16. notificationFrame.Size = UDim2.new(0.3, 0, 0.1, 0)
  17. notificationFrame.Position = UDim2.new(0.35, 0, 0.05, 0)
  18. notificationFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  19. notificationFrame.BorderSizePixel = 0
  20. notificationFrame.BackgroundTransparency = 0.7
  21. notificationFrame.Parent = screenGui
  22. debugPrint("Notification Frame created")
  23.  
  24. -- Add a TextLabel for the notification message
  25. local notificationText = Instance.new("TextLabel")
  26. notificationText.Size = UDim2.new(1, 0, 1, 0)
  27. notificationText.Position = UDim2.new(0, 0, 0, 0)
  28. notificationText.BackgroundTransparency = 1
  29. notificationText.TextColor3 = Color3.fromRGB(255, 255, 255)
  30. notificationText.TextStrokeTransparency = 0.5
  31. notificationText.Text = "By d00kfe"
  32. notificationText.TextScaled = true
  33. notificationText.Parent = notificationFrame
  34. debugPrint("Notification TextLabel created")
  35.  
  36. -- TweenService for animation
  37. local TweenService = game:GetService("TweenService")
  38. local tweenInfoIn = TweenInfo.new(0.7, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
  39. local tweenInfoOut = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
  40.  
  41. local tweenIn = TweenService:Create(notificationFrame, tweenInfoIn, {Position = UDim2.new(0.35, 0, 0.05, 0), BackgroundTransparency = 0.7})
  42. local tweenOut = TweenService:Create(notificationFrame, tweenInfoOut, {Position = UDim2.new(0.35, 0, -0.2, 0), BackgroundTransparency = 1})
  43.  
  44. -- Display the notification
  45. tweenIn:Play()
  46. wait(2)
  47. tweenOut:Play()
  48.  
  49. -- Cleanup after tween completes
  50. tweenOut.Completed:Connect(function()
  51. screenGui:Destroy()
  52. debugPrint("Notification GUI destroyed")
  53. end)
  54. end
  55.  
  56. -- Function to create the Player Hiding GUI
  57. local function createPlayerHidingGUI()
  58. local Players = game:GetService("Players")
  59. local LocalPlayer = Players.LocalPlayer
  60. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  61.  
  62. -- Create ScreenGui
  63. local screenGui = Instance.new("ScreenGui")
  64. screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")
  65. debugPrint("Player Hiding GUI created")
  66.  
  67. -- Create draggable Frame for GUI
  68. local draggableFrame = Instance.new("Frame")
  69. draggableFrame.Size = UDim2.new(0, 200, 0, 200)
  70. draggableFrame.Position = UDim2.new(0.5, -100, 0.3, -100)
  71. draggableFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  72. draggableFrame.BorderSizePixel = 0
  73. draggableFrame.BackgroundTransparency = 0.7
  74. draggableFrame.Parent = screenGui
  75. debugPrint("Draggable Frame created")
  76.  
  77. -- Add drag functionality
  78. local dragging, dragStart, startPos
  79. local function onInput(input)
  80. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  81. dragging = true
  82. dragStart = input.Position
  83. startPos = draggableFrame.Position
  84. end
  85. end
  86.  
  87. local function onInputChange(input)
  88. if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
  89. local delta = input.Position - dragStart
  90. draggableFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  91. end
  92. end
  93.  
  94. local function onInputEnd(input)
  95. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  96. dragging = false
  97. end
  98. end
  99.  
  100. draggableFrame.InputBegan:Connect(onInput)
  101. draggableFrame.InputChanged:Connect(onInputChange)
  102. draggableFrame.InputEnded:Connect(onInputEnd)
  103.  
  104. -- Create TextBox for username input
  105. local usernameInput = Instance.new("TextBox")
  106. usernameInput.Name = "UsernameInput"
  107. usernameInput.Size = UDim2.new(0, 200, 0, 50)
  108. usernameInput.Position = UDim2.new(0.5, -100, 0.3, 0)
  109. usernameInput.PlaceholderText = "Enter username here or 'all'"
  110. usernameInput.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  111. usernameInput.TextColor3 = Color3.fromRGB(255, 255, 255)
  112. usernameInput.Parent = draggableFrame
  113. debugPrint("UsernameInput TextBox created")
  114.  
  115. -- Create TextButton for hiding player
  116. local hideButton = Instance.new("TextButton")
  117. hideButton.Name = "HideButton"
  118. hideButton.Size = UDim2.new(0, 200, 0, 50)
  119. hideButton.Position = UDim2.new(0.5, -100, 0.4, 0)
  120. hideButton.Text = "Hide Player(s)"
  121. hideButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  122. hideButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  123. hideButton.Parent = draggableFrame
  124. debugPrint("HideButton created")
  125.  
  126. -- Create TextLabel for status messages
  127. local statusLabel = Instance.new("TextLabel")
  128. statusLabel.Name = "StatusLabel"
  129. statusLabel.Size = UDim2.new(0, 200, 0, 50)
  130. statusLabel.Position = UDim2.new(0.5, -100, 0.5, 0)
  131. statusLabel.Text = ""
  132. statusLabel.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  133. statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  134. statusLabel.Parent = draggableFrame
  135. debugPrint("StatusLabel created")
  136.  
  137. -- Function to hide all players
  138. local function hideAllPlayers()
  139. local players = Players:GetPlayers()
  140. for _, player in pairs(players) do
  141. if player ~= LocalPlayer and player.Character then
  142. local character = player.Character
  143.  
  144. -- Hide all BaseParts of the character
  145. for _, part in pairs(character:GetChildren()) do
  146. if part:IsA("BasePart") then
  147. part.Transparency = 1
  148. part.CanCollide = false
  149. end
  150. end
  151.  
  152. -- Hide the character's accessories
  153. for _, accessory in pairs(character:GetChildren()) do
  154. if accessory:IsA("Accessory") then
  155. local handle = accessory:FindFirstChild("Handle")
  156. if handle then
  157. handle.Transparency = 1
  158. end
  159. end
  160. end
  161.  
  162. -- Hide the humanoid
  163. local humanoid = character:FindFirstChildOfClass("Humanoid")
  164. if humanoid then
  165. humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
  166. end
  167.  
  168. -- Hide player GUI elements
  169. local playerGui = player:FindFirstChildOfClass("PlayerGui")
  170. if playerGui then
  171. playerGui:Destroy()
  172. end
  173. end
  174. end
  175.  
  176. -- Hide all chat messages
  177. local chatEvents = ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents")
  178. if chatEvents then
  179. local function onMessageReceived(message)
  180. if message and message.Parent == chatEvents then
  181. message:Destroy()
  182. end
  183. end
  184.  
  185. chatEvents.OnMessageReceived:Connect(onMessageReceived)
  186. end
  187.  
  188. statusLabel.Text = "All players are now hidden from your view."
  189. debugPrint("All players hidden")
  190. end
  191.  
  192. -- Function to hide a specific player
  193. local function hidePlayer(username)
  194. local playerToHide = Players:FindFirstChild(username)
  195. if playerToHide and playerToHide.Character then
  196. local character = playerToHide.Character
  197.  
  198. -- Hide all BaseParts of the character
  199. for _, part in pairs(character:GetChildren()) do
  200. if part:IsA("BasePart") then
  201. part.Transparency = 1
  202. part.CanCollide = false
  203. end
  204. end
  205.  
  206. -- Hide the character's accessories
  207. for _, accessory in pairs(character:GetChildren()) do
  208. if accessory:IsA("Accessory") then
  209. local handle = accessory:FindFirstChild("Handle")
  210. if handle then
  211. handle.Transparency = 1
  212. end
  213. end
  214. end
  215.  
  216. -- Hide the humanoid
  217. local humanoid = character:FindFirstChildOfClass("Humanoid")
  218. if humanoid then
  219. humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
  220. end
  221.  
  222. -- Hide player GUI elements
  223. local playerGui = playerToHide:FindFirstChildOfClass("PlayerGui")
  224. if playerGui then
  225. playerGui:Destroy()
  226. end
  227.  
  228. -- Hide messages from the specific player
  229. local chatEvents = ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents")
  230. if chatEvents then
  231. local function onMessageReceived(message)
  232. if message and message.Parent == chatEvents then
  233. local messageSender = message:FindFirstChild("Sender")
  234. if messageSender and messageSender.Value == playerToHide then
  235. message:Destroy()
  236. end
  237. end
  238. end
  239.  
  240. chatEvents.OnMessageReceived:Connect(onMessageReceived)
  241. end
  242.  
  243. statusLabel.Text = username .. " is now hidden from your view."
  244. debugPrint(username .. " hidden")
  245. else
  246. statusLabel.Text = "Player not found or character not loaded."
  247. debugPrint("Player not found or character not loaded")
  248. end
  249. end
  250.  
  251. -- Connect button click to function
  252. hideButton.MouseButton1Click:Connect(function()
  253. local username = usernameInput.Text
  254. if username == "all" then
  255. hideAllPlayers()
  256. else
  257. hidePlayer(username)
  258. end
  259. end)
  260. end
  261.  
  262. -- Execute both functions
  263. createNotification()
  264. createPlayerHidingGUI()
  265.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement