0% found this document useful (0 votes)
71 views3 pages

Fling GUI

The document outlines a script for a Fling GUI in a game, allowing players to search for and fling other players by name. It includes functions for creating a draggable user interface, finding players, and applying a fling effect using BodyThrust. Additionally, it provides user feedback through notifications upon successful actions and GUI loading.

Uploaded by

sailaubekadilhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views3 pages

Fling GUI

The document outlines a script for a Fling GUI in a game, allowing players to search for and fling other players by name. It includes functions for creating a draggable user interface, finding players, and applying a fling effect using BodyThrust. Additionally, it provides user feedback through notifications upon successful actions and GUI loading.

Uploaded by

sailaubekadilhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- Variables

local Players = game:GetService("Players")


local LocalPlayer = [Link]
local StarterGui = game:GetService("StarterGui")
local UserInputService = game:GetService("UserInputService") -- Added
UserInputService

-- Function to find players


local function findPlayers(searchString)
local foundPlayers = {}
for _, player in pairs(Players:GetPlayers()) do
if [Link]:lower():sub(1, #searchString) == searchString:lower()
then
[Link](foundPlayers, player)
end
end
return foundPlayers
end

-- Create draggable GUI


local flingGui = [Link]("ScreenGui")
[Link] = "FlingGui"
[Link] = LocalPlayer:WaitForChild("PlayerGui")
[Link] = false

local mainFrame = [Link]("Frame")


[Link] = "MainFrame"
[Link] = flingGui
[Link] = [Link](0.5, -150, 0.5, -100)
[Link] = [Link](0, 300, 0, 250)
mainFrame.BackgroundColor3 = [Link](49, 49, 49)
[Link] = 0
[Link] = 2
[Link] = true -- Make the frame draggable

local title = [Link]("TextLabel")


[Link] = mainFrame
[Link] = [Link](1, 0, 0.1, 0)
title.BackgroundColor3 = [Link](57, 57, 57)
[Link] = 0
[Link] = [Link]
[Link] = 20
title.TextColor3 = [Link](255, 255, 255)
[Link] = "Fling GUI"
[Link] = 2

local targetTextBox = [Link]("TextBox")


[Link] = mainFrame
[Link] = [Link](0.1, 0, 0.15, 0)
[Link] = [Link](0.8, 0, 0.15, 0)
targetTextBox.BackgroundColor3 = [Link](57, 57, 57)
[Link] = 0
[Link] = [Link]
[Link] = 18
[Link] = "Enter player name..."
[Link] = ""
[Link] = 2

local flingButton = [Link]("TextButton")


[Link] = mainFrame
[Link] = [Link](0.1, 0, 0.35, 0)
[Link] = [Link](0.8, 0, 0.15, 0)
flingButton.BackgroundColor3 = [Link](57, 57, 57)
[Link] = 0
[Link] = [Link]
[Link] = 18
[Link] = "Fling!"
flingButton.TextColor3 = [Link](255, 255, 255)
[Link] = 2

local notification = [Link]("TextLabel")


[Link] = mainFrame
[Link] = [Link](0.1, 0, 0.55, 0)
[Link] = [Link](0.8, 0, 0.2, 0)
[Link] = 1
[Link] = [Link]
[Link] = 16
notification.TextColor3 = [Link](255, 0, 0)
[Link] = true
[Link] = 2

-- Make the UI draggable


local dragging
local dragStart

[Link]:Connect(function(input)
if [Link] == [Link].MouseButton1 then
dragging = true
dragStart = [Link] - [Link]
[Link]:Connect(function()
if [Link] == [Link] then
dragging = false
end
end)
end
end)

[Link]:Connect(function(input)
if dragging then
[Link] = [Link](0, [Link].X - dragStart.X, 0,
[Link].Y - dragStart.Y)
end
end)

-- Function to perform the fling


local function flingPlayer(targetPlayer)
if targetPlayer and [Link] and
[Link]:FindFirstChild("HumanoidRootPart") then
local Thrust = [Link]('BodyThrust',
[Link])
[Link] = [Link](0, 10000, 0)
wait(0.1)
Thrust:Destroy()
end
end

-- Connect button click event


flingButton.MouseButton1Click:Connect(function()
local targetName = [Link]
local targetPlayers = findPlayers(targetName)

if #targetPlayers > 0 then


for _, player in pairs(targetPlayers) do
flingPlayer(player)
end
[Link] = "Fling successful!"
else
[Link] = "Invalid player"
end
end)

-- Notification for successful load


StarterGui:SetCore("SendNotification", {
Title = "Fling GUI",
Text = "Loaded successfully! Created by Innovation",
Icon = "rbxassetid://2005276185",
Duration = 5
})

You might also like