make a box to type a player's name, who ever the target is unanchored parts fly towards them like they are a walking blackhole
To create an effect in a game, such as in Roblox, where unanchored parts fly towards a player like they're a walking black hole, you'll need to use some scripting. Here’s a basic example of how you can achieve this using Lua scripting in Roblox. This script assumes you have a GUI with a textbox for the player's name.
### Step 1: Set Up Your GUI
1. In Roblox Studio, create a ScreenGui.
2. Add a TextBox for inputting the player's name.
3. Add a Button that the player will click to activate the effect.
### Step 2: Create the Script
In the LocalScript for the GUI, you'll handle getting the player's name, finding that player in the game, and then causing the unanchored parts to move toward them.
#### Example LocalScript
```lua
local player = game.Players.LocalPlayer
local textbox = script.Parent.TextBox -- Reference to your TextBox
local button = script.Parent.Button -- Reference to your Button
local unanchoredParts = workspace:GetChildren() -- Get all parts in the workspace
button.MouseButton1Click:Connect(function()
local targetPlayerName = textbox.Text
local targetPlayer = game.Players:FindFirstChild(targetPlayerName)
if targetPlayer and targetPlayer.Character then
local targetPosition = targetPlayer.Character.PrimaryPart.Position
for _, part in ipairs(unanchoredParts) do
if part:IsA("BasePart") and not part.Anchored then
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = (targetPosition - part.Position).unit * 100 -- Adjust the multiplier for speed
bodyVelocity.MaxForce = Vector3.new(10000, 10000, 10000)
bodyVelocity.Parent = part
-- Optional: Clean up after some time
game:GetService("Debris"):AddItem(bodyVelocity, 0.5) -- Remove BodyVelocity after 0.5 seconds
end
end
else
print("Target player not found or has no character.")
end
end)
```
### Step 3: How to Use
1. Open Roblox Studio.
2. Create a new `ScreenGui` in the StarterGui.
3. Insert a `TextBox` and a `TextButton` into the `ScreenGui`.
4. Add the `LocalScript` to the `ScreenGui`.
5. Play the game in Studio, type a player's name into the textbox, and click the button.
### Explanation of the Script
- The script listens for a button click.
- It checks the input to find the specified player and retrieves their character's position.
- For each unanchored part in the workspace, the script creates a `BodyVelocity` that sets the velocity of the part towards the player's position.
- You can adjust the speed by changing the multiplier in the `Velocity`.
### Notes
- Ensure that the parts you want to fly towards the player are unanchored.
- You can customize the speed and behavior as needed.
- Handle cases where the player name input is invalid or doesn't exist properly.


