Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create the ScreenGui
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "BringGui"
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- -- Create the Frame
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 150)
- frame.Position = UDim2.new(0.5, -150, 0.5, -75)
- frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
- frame.Parent = screenGui
- -- Create the TextBox for player input
- local textBox = Instance.new("TextBox")
- textBox.Size = UDim2.new(0, 280, 0, 50)
- textBox.Position = UDim2.new(0, 10, 0, 20)
- textBox.PlaceholderText = "DisplayName/Name"
- textBox.Text = ""
- textBox.Parent = frame
- -- Create the "Bring" button
- local bringButton = Instance.new("TextButton")
- bringButton.Size = UDim2.new(0, 280, 0, 50)
- bringButton.Position = UDim2.new(0, 10, 0, 80)
- bringButton.Text = "BRING"
- bringButton.Parent = frame
- -- Bring function
- local function bringPlayer()
- local playerName = textBox.Text
- local targetPlayer = game.Players:FindFirstChild(playerName)
- if targetPlayer and targetPlayer.Character then
- -- Move the target player's character to the local player's position
- targetPlayer.Character:SetPrimaryPartCFrame(game.Players.LocalPlayer.Character.PrimaryPart.CFrame)
- else
- print("Player not found or not in game.")
- end
- end
- -- Connect the button to the bring function
- bringButton.MouseButton1Click:Connect(bringPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement