Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local localPlayer = Players.LocalPlayer
- local targetPlayer = nil
- local fling = false
- local targetHRP = nil
- -- GUI setup
- local ScreenGui = Instance.new("ScreenGui")
- local Frame = Instance.new("Frame")
- local TextBox = Instance.new("TextBox")
- local FlingButton = Instance.new("TextButton")
- local StopButton = Instance.new("TextButton")
- ScreenGui.Parent = game:GetService("CoreGui") -- Parent to CoreGui to keep it persistent
- Frame.Parent = ScreenGui
- Frame.Size = UDim2.new(0, 300, 0, 200)
- Frame.Position = UDim2.new(0.5, -150, 0.5, -100)
- Frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- Frame.BorderSizePixel = 0
- Frame.AnchorPoint = Vector2.new(0.5, 0.5)
- -- TextBox to enter player name
- TextBox.Parent = Frame
- TextBox.Size = UDim2.new(0, 200, 0, 30)
- TextBox.Position = UDim2.new(0.5, -100, 0.2, 0)
- TextBox.PlaceholderText = "Enter Player Name"
- TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
- TextBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- -- Fling Button
- FlingButton.Parent = Frame
- FlingButton.Size = UDim2.new(0, 200, 0, 40)
- FlingButton.Position = UDim2.new(0.5, -100, 0.5, -20)
- FlingButton.Text = "Start Fling"
- FlingButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- FlingButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
- -- Stop Button
- StopButton.Parent = Frame
- StopButton.Size = UDim2.new(0, 200, 0, 40)
- StopButton.Position = UDim2.new(0.5, -100, 0.7, 0)
- StopButton.Text = "Stop Fling"
- StopButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- StopButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- -- Variables for dragging functionality
- local dragging = false
- local dragStartPos = nil
- local offset = nil
- -- Function to handle dragging
- local function startDragging(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStartPos = input.Position
- offset = Frame.Position - UDim2.new(0, dragStartPos.X, 0, dragStartPos.Y)
- end
- end
- local function onDrag(input)
- if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
- local delta = input.Position - dragStartPos
- Frame.Position = UDim2.new(0, offset.X + delta.X, 0, offset.Y + delta.Y)
- end
- end
- local function stopDragging(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = false
- end
- end
- -- Connect the drag functions to the GUI
- Frame.InputBegan:Connect(startDragging)
- Frame.InputChanged:Connect(onDrag)
- Frame.InputEnded:Connect(stopDragging)
- -- Find player by partial name or display name
- local function findPlayerByPartialName(partial)
- partial = partial:lower()
- for _, player in ipairs(Players:GetPlayers()) do
- if player ~= localPlayer then
- local uname = player.Name:lower()
- local dname = player.DisplayName:lower()
- if uname:sub(1, #partial) == partial or dname:sub(1, #partial) == partial then
- return player
- end
- end
- end
- return nil
- end
- -- Handle character respawn
- local function onCharacterAdded(character)
- local targetHRP = character:WaitForChild("HumanoidRootPart")
- end
- -- Listen for respawns of the target player
- if targetPlayer then
- targetPlayer.CharacterAdded:Connect(onCharacterAdded)
- end
- -- Fling logic
- RunService.Heartbeat:Connect(function()
- local myChar = localPlayer.Character
- local myHRP = myChar and myChar:FindFirstChild("HumanoidRootPart")
- if myHRP then
- -- Only cancel velocity if you're being flung abnormally (not walking or jumping)
- if myHRP.Velocity.Magnitude > 200 then
- myHRP.Velocity = Vector3.zero
- end
- if myHRP.RotVelocity.Magnitude > 200 then
- myHRP.RotVelocity = Vector3.zero
- end
- end
- -- Fling logic
- if fling and targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("Head") and myHRP then
- local targetHead = targetPlayer.Character.Head
- local targetHRP = targetPlayer.Character.HumanoidRootPart
- -- Teleport to target player's head (sit on their head)
- myHRP.CFrame = targetHead.CFrame * CFrame.new(0, 2, 0) -- Position the player slightly above the head
- -- Apply much stronger force to fling the target
- local velocity = Vector3.new(math.random(-500, 500), math.random(500, 1000), math.random(-500, 500)) -- Stronger random fling direction and strength
- myHRP.Velocity = velocity
- myHRP.RotVelocity = Vector3.new(math.random(5000, 10000), math.random(5000, 10000), math.random(5000, 10000)) -- Stronger rotational force for extreme fling action
- end
- end)
- -- Start Fling Button Click
- FlingButton.MouseButton1Click:Connect(function()
- local playerName = TextBox.Text
- if playerName and playerName ~= "" then
- local player = findPlayerByPartialName(playerName)
- if player then
- targetPlayer = player
- fling = true
- print("Flinging: " .. player.Name)
- else
- print("No player found starting with: " .. playerName)
- end
- else
- print("Please enter a player name.")
- end
- end)
- -- Stop Fling Button Click
- StopButton.MouseButton1Click:Connect(function()
- fling = false
- targetPlayer = nil
- print("Fling stopped.")
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement