Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local gui = Instance.new("ScreenGui")
- gui.Parent = player:WaitForChild("PlayerGui")
- -- Create Frame (Draggable)
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 200, 0, 300)
- frame.Position = UDim2.new(0, 20, 0, 100)
- frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- frame.Active = true
- frame.Draggable = true -- Makes it movable
- frame.Parent = gui
- -- Title
- local title = Instance.new("TextLabel")
- title.Size = UDim2.new(1, 0, 0, 40)
- title.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
- title.Text = "Teleport GUI"
- title.TextColor3 = Color3.new(1, 1, 1)
- title.Font = Enum.Font.SourceSansBold
- title.TextSize = 20
- title.Parent = frame
- -- Scrolling Frame for Players
- local scroll = Instance.new("ScrollingFrame")
- scroll.Size = UDim2.new(1, 0, 1, -40)
- scroll.Position = UDim2.new(0, 0, 0, 40)
- scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
- scroll.ScrollBarThickness = 5
- scroll.Parent = frame
- local UIList = Instance.new("UIListLayout")
- UIList.Parent = scroll
- UIList.Padding = UDim.new(0, 5)
- -- Function to Update Player List
- local function updatePlayerList()
- -- Clear old buttons
- for _, child in pairs(scroll:GetChildren()) do
- if child:IsA("TextButton") then
- child:Destroy()
- end
- end
- for _, otherPlayer in pairs(game.Players:GetPlayers()) do
- if otherPlayer ~= player then
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(1, 0, 0, 40)
- button.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
- button.TextColor3 = Color3.new(1, 1, 1)
- button.Font = Enum.Font.SourceSans
- button.TextSize = 18
- button.Text = otherPlayer.Name
- button.Parent = scroll
- button.MouseButton1Click:Connect(function()
- if player.Character and player.Character:FindFirstChild("HumanoidRootPart") and otherPlayer.Character then
- local playerRoot = player.Character:FindFirstChild("HumanoidRootPart")
- local otherRoot = otherPlayer.Character:FindFirstChild("HumanoidRootPart")
- if playerRoot and otherRoot then
- otherPlayer.Character:MoveTo(playerRoot.Position + Vector3.new(0, 3, 0))
- end
- end
- end)
- end
- end
- scroll.CanvasSize = UDim2.new(0, 0, 0, UIList.AbsoluteContentSize.Y)
- end
- -- Update when players join or leave
- game.Players.PlayerAdded:Connect(updatePlayerList)
- game.Players.PlayerRemoving:Connect(updatePlayerList)
- updatePlayerList()
Advertisement
Add Comment
Please, Sign In to add comment