Advertisement
EpicGamerSander1345

Sander's GUI

Apr 20th, 2025 (edited)
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.03 KB | Source Code | 0 0
  1. local ScreenGui = Instance.new("ScreenGui")
  2. local Frame = Instance.new("Frame")
  3. local Title = Instance.new("TextLabel")
  4. local TextBox = Instance.new("TextBox")
  5. local FlingButton = Instance.new("TextButton")
  6. local StopFlingButton = Instance.new("TextButton")
  7. local Players = game:GetService("Players")
  8.  
  9. -- Ensure the script is a LocalScript and parent GUI to Player's PlayerGui
  10. local player = Players.LocalPlayer
  11. local playerGui = player:WaitForChild("PlayerGui")
  12. ScreenGui.Parent = playerGui
  13.  
  14. -- Configure Frame
  15. Frame.Size = UDim2.new(0, 350, 0, 250)
  16. Frame.Position = UDim2.new(0.5, -175, 0.5, -125)
  17. Frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) -- Dark gray background
  18. Frame.BorderSizePixel = 0
  19. Frame.Active = true
  20. Frame.Draggable = true
  21. Frame.Parent = ScreenGui
  22.  
  23. -- Configure Title
  24. Title.Size = UDim2.new(1, 0, 0, 40)
  25. Title.Position = UDim2.new(0, 0, 0, 0)
  26. Title.BackgroundColor3 = Color3.fromRGB(50, 50, 50) -- Slightly lighter gray
  27. Title.BorderSizePixel = 0
  28. Title.Text = "Fling GUI"
  29. Title.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  30. Title.Font = Enum.Font.GothamBold
  31. Title.TextSize = 20
  32. Title.Parent = Frame
  33.  
  34. -- Configure TextBox
  35. TextBox.Size = UDim2.new(0.9, 0, 0, 40)
  36. TextBox.Position = UDim2.new(0.05, 0, 0.2, 0)
  37. TextBox.PlaceholderText = "Enter part of username..."
  38. TextBox.Text = ""
  39. TextBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40) -- Darker gray
  40. TextBox.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  41. TextBox.Font = Enum.Font.Gotham
  42. TextBox.TextSize = 16
  43. TextBox.BorderSizePixel = 0
  44. TextBox.Parent = Frame
  45.  
  46. -- Configure Fling Button
  47. FlingButton.Size = UDim2.new(0.9, 0, 0, 40)
  48. FlingButton.Position = UDim2.new(0.05, 0, 0.4, 0)
  49. FlingButton.Text = "Fling Target"
  50. FlingButton.BackgroundColor3 = Color3.fromRGB(70, 130, 180) -- Steel blue
  51. FlingButton.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  52. FlingButton.Font = Enum.Font.GothamBold
  53. FlingButton.TextSize = 16
  54. FlingButton.BorderSizePixel = 0
  55. FlingButton.Parent = Frame
  56.  
  57. -- Configure Stop Fling Button
  58. StopFlingButton.Size = UDim2.new(0.9, 0, 0, 40)
  59. StopFlingButton.Position = UDim2.new(0.05, 0, 0.6, 0)
  60. StopFlingButton.Text = "Stop Fling"
  61. StopFlingButton.BackgroundColor3 = Color3.fromRGB(220, 20, 60) -- Crimson red
  62. StopFlingButton.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
  63. StopFlingButton.Font = Enum.Font.GothamBold
  64. StopFlingButton.TextSize = 16
  65. StopFlingButton.BorderSizePixel = 0
  66. StopFlingButton.Parent = Frame
  67.  
  68. -- Add rounded corners to elements
  69. local function addUICorner(instance, radius)
  70.     local uiCorner = Instance.new("UICorner")
  71.     uiCorner.CornerRadius = UDim.new(0, radius)
  72.     uiCorner.Parent = instance
  73. end
  74.  
  75. addUICorner(Frame, 10)
  76. addUICorner(Title, 10)
  77. addUICorner(TextBox, 10)
  78. addUICorner(FlingButton, 10)
  79. addUICorner(StopFlingButton, 10)
  80.  
  81. -- Function to find player by partial name
  82. local function findPlayerByName(partialName)
  83.     for _, player in ipairs(Players:GetPlayers()) do
  84.         if string.find(string.lower(player.Name), string.lower(partialName)) or
  85.            string.find(string.lower(player.DisplayName), string.lower(partialName)) then
  86.             return player
  87.         end
  88.     end
  89.     return nil
  90. end
  91.  
  92. -- Function to update the textbox with the full name
  93. local function updateTextBoxWithFullName(player)
  94.     TextBox.Text = "@" .. player.DisplayName .. ", " .. player.Name
  95. end
  96.  
  97. -- Variables to manage fling state
  98. local activeBodyVelocity = nil
  99. local flingConnection = nil
  100.  
  101. -- Fling Button click event
  102. FlingButton.MouseButton1Click:Connect(function()
  103.     local partialName = TextBox.Text
  104.     if partialName == "" then
  105.         warn("Please enter a username.")
  106.         return
  107.     end
  108.  
  109.     local targetPlayer = findPlayerByName(partialName)
  110.     if not targetPlayer then
  111.         warn("Player not found.")
  112.         return
  113.     end
  114.  
  115.     updateTextBoxWithFullName(targetPlayer)
  116.  
  117.     local targetCharacter = targetPlayer.Character
  118.     local localCharacter = Players.LocalPlayer.Character
  119.  
  120.     if targetCharacter and localCharacter then
  121.         local targetTorso = targetCharacter:FindFirstChild("HumanoidRootPart")
  122.         if not targetTorso then
  123.             warn("Target's HumanoidRootPart not found.")
  124.             return
  125.         end
  126.        
  127.         local localTorso = localCharacter:FindFirstChild("HumanoidRootPart")
  128.         if targetTorso and localTorso then
  129.             -- Attach local player to target's torso
  130.             localTorso.CFrame = targetTorso.CFrame
  131.  
  132.             -- Apply extremely powerful and instant fling velocity to target
  133.             local bodyVelocity = Instance.new("BodyVelocity")
  134.             bodyVelocity.Velocity = Vector3.new(0, 1e8, 0) -- Extremely high upward velocity for an even more powerful fling
  135.             bodyVelocity.MaxForce = Vector3.new(1e6, 1e6, 1e6)
  136.             bodyVelocity.Parent = targetTorso
  137.  
  138.             -- Store the BodyVelocity instance
  139.             activeBodyVelocity = bodyVelocity
  140.  
  141.             -- Continuously update local player's position to stay inside the target's torso
  142.             flingConnection = game:GetService("RunService").Heartbeat:Connect(function()
  143.                 if not targetTorso or not localTorso or not activeBodyVelocity then
  144.                     if flingConnection then
  145.                         flingConnection:Disconnect()
  146.                         flingConnection = nil
  147.                     end
  148.                     return
  149.                 end
  150.                 localTorso.CFrame = targetTorso.CFrame
  151.             end)
  152.         end
  153.     end
  154. end)
  155.  
  156. -- Stop Fling Button click event
  157. StopFlingButton.MouseButton1Click:Connect(function()
  158.     if activeBodyVelocity then
  159.         activeBodyVelocity:Destroy()
  160.         activeBodyVelocity = nil
  161.     end
  162.  
  163.     if flingConnection then
  164.         flingConnection:Disconnect()
  165.         flingConnection = nil
  166.     end
  167.  
  168.     -- Reset player's health to respawn
  169.     local character = player.Character
  170.     if character then
  171.         local humanoid = character:FindFirstChild("Humanoid")
  172.         if humanoid then
  173.             humanoid.Health = 0
  174.         end
  175.     end
  176. end)
  177.  
Tags: Roblox lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement