Advertisement
Guest User

Admin kick hub v2 paste

a guest
Sep 15th, 2024
5,075
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 1
  1. local UIS = game:GetService("UserInputService")
  2. local Players = game:GetService("Players")
  3. local frame = script.Parent
  4. local textBox = frame:FindFirstChild("TextBox")
  5. local button = frame:FindFirstChild("TextButton")
  6.  
  7. local dragging = false
  8. local dragInput
  9. local dragStart
  10. local startPos
  11.  
  12. -- Function to update the frame's position
  13. local function update(input)
  14. local delta = input.Position - dragStart
  15. frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  16. end
  17.  
  18. -- Function to kick player
  19. local function kickPlayer(username)
  20. local player = Players:FindFirstChild(username)
  21. if player then
  22. player:Kick("You have been kicked from the game.")
  23. else
  24. print("User not found.")
  25. end
  26. end
  27.  
  28. -- Dragging functionality
  29. frame.InputBegan:Connect(function(input)
  30. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  31. dragging = true
  32. dragStart = input.Position
  33. startPos = frame.Position
  34.  
  35. input.Changed:Connect(function()
  36. if input.UserInputState == Enum.UserInputState.End then
  37. dragging = false
  38. end
  39. end)
  40. end
  41. end)
  42.  
  43. frame.InputChanged:Connect(function(input)
  44. if input.UserInputType == Enum.UserInputType.MouseMovement then
  45. dragInput = input
  46. end
  47. end)
  48.  
  49. UIS.InputChanged:Connect(function(input)
  50. if input == dragInput and dragging then
  51. update(input)
  52. end
  53. end)
  54.  
  55. -- Button click functionality
  56. button.MouseButton1Click:Connect(function()
  57. local username = textBox.Text
  58. kickPlayer(username)
  59. end)
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement