BangsNgek

Untitled

Aug 3rd, 2025
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.60 KB | Source Code | 0 0
  1. local player = game.Players.LocalPlayer
  2. local gui = Instance.new("ScreenGui")
  3. gui.Parent = player:WaitForChild("PlayerGui")
  4.  
  5. -- Create Frame (Draggable)
  6. local frame = Instance.new("Frame")
  7. frame.Size = UDim2.new(0, 200, 0, 300)
  8. frame.Position = UDim2.new(0, 20, 0, 100)
  9. frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  10. frame.Active = true
  11. frame.Draggable = true  -- Makes it movable
  12. frame.Parent = gui
  13.  
  14. -- Title
  15. local title = Instance.new("TextLabel")
  16. title.Size = UDim2.new(1, 0, 0, 40)
  17. title.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  18. title.Text = "Teleport GUI"
  19. title.TextColor3 = Color3.new(1, 1, 1)
  20. title.Font = Enum.Font.SourceSansBold
  21. title.TextSize = 20
  22. title.Parent = frame
  23.  
  24. -- Scrolling Frame for Players
  25. local scroll = Instance.new("ScrollingFrame")
  26. scroll.Size = UDim2.new(1, 0, 1, -40)
  27. scroll.Position = UDim2.new(0, 0, 0, 40)
  28. scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
  29. scroll.ScrollBarThickness = 5
  30. scroll.Parent = frame
  31.  
  32. local UIList = Instance.new("UIListLayout")
  33. UIList.Parent = scroll
  34. UIList.Padding = UDim.new(0, 5)
  35.  
  36. -- Function to Update Player List
  37. local function updatePlayerList()
  38.     -- Clear old buttons
  39.     for _, child in pairs(scroll:GetChildren()) do
  40.         if child:IsA("TextButton") then
  41.             child:Destroy()
  42.         end
  43.     end
  44.  
  45.     for _, otherPlayer in pairs(game.Players:GetPlayers()) do
  46.         if otherPlayer ~= player then
  47.             local button = Instance.new("TextButton")
  48.             button.Size = UDim2.new(1, 0, 0, 40)
  49.             button.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  50.             button.TextColor3 = Color3.new(1, 1, 1)
  51.             button.Font = Enum.Font.SourceSans
  52.             button.TextSize = 18
  53.             button.Text = otherPlayer.Name
  54.             button.Parent = scroll
  55.  
  56.             button.MouseButton1Click:Connect(function()
  57.                 if player.Character and player.Character:FindFirstChild("HumanoidRootPart") and otherPlayer.Character then
  58.                     local playerRoot = player.Character:FindFirstChild("HumanoidRootPart")
  59.                     local otherRoot = otherPlayer.Character:FindFirstChild("HumanoidRootPart")
  60.                     if playerRoot and otherRoot then
  61.                         otherPlayer.Character:MoveTo(playerRoot.Position + Vector3.new(0, 3, 0))
  62.                     end
  63.                 end
  64.             end)
  65.         end
  66.     end
  67.  
  68.     scroll.CanvasSize = UDim2.new(0, 0, 0, UIList.AbsoluteContentSize.Y)
  69. end
  70.  
  71. -- Update when players join or leave
  72. game.Players.PlayerAdded:Connect(updatePlayerList)
  73. game.Players.PlayerRemoving:Connect(updatePlayerList)
  74. updatePlayerList()
Advertisement
Add Comment
Please, Sign In to add comment