Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create the GUI
- local ScreenGui = Instance.new("ScreenGui")
- local Frame = Instance.new("Frame")
- local TeleportButton = Instance.new("TextButton")
- local TopTextLabel = Instance.new("TextLabel")
- local BottomTextLabel = Instance.new("TextLabel")
- -- Properties
- ScreenGui.Name = "BallTeleportGui"
- ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- Frame.Name = "Frame"
- Frame.Parent = ScreenGui
- Frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- Frame.Size = UDim2.new(0, 250, 0, 150) -- Smaller size of the frame
- Frame.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame.Position = UDim2.new(0.5, 0, 0.5, 0) -- Centered
- Frame.Active = true
- Frame.Draggable = true
- -- Create the Top TextLabel
- TopTextLabel.Name = "TopTextLabel"
- TopTextLabel.Parent = Frame
- TopTextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- TopTextLabel.BackgroundTransparency = 1 -- Make the background transparent
- TopTextLabel.Position = UDim2.new(0, 0, 0, 0) -- Positioned at the top of the Frame
- TopTextLabel.Size = UDim2.new(1, 0, 0.2, 0) -- Adjust size to fit at the top
- TopTextLabel.Font = Enum.Font.Cartoon
- TopTextLabel.Text = "Made with hate by Lennox"
- TopTextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- TopTextLabel.TextScaled = true
- TopTextLabel.TextStrokeTransparency = 0.8
- -- Create the Teleport Button
- TeleportButton.Name = "TeleportButton"
- TeleportButton.Parent = Frame
- TeleportButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- TeleportButton.Size = UDim2.new(0.6, 0, 0.25, 0) -- Size of the button
- TeleportButton.AnchorPoint = Vector2.new(0.5, 0.5)
- TeleportButton.Position = UDim2.new(0.5, 0, 0.5, 0) -- Centered
- TeleportButton.Font = Enum.Font.Cartoon
- TeleportButton.Text = "Teleport Ball"
- TeleportButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- TeleportButton.TextScaled = true
- -- Create the Bottom TextLabel
- BottomTextLabel.Name = "BottomTextLabel"
- BottomTextLabel.Parent = Frame
- BottomTextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- BottomTextLabel.BackgroundTransparency = 1 -- Make the background transparent
- BottomTextLabel.Position = UDim2.new(0, 0, 0.75, 0) -- Positioned at the bottom of the Frame
- BottomTextLabel.Size = UDim2.new(1, 0, 0.2, 0) -- Adjust size to fit at the bottom
- BottomTextLabel.Font = Enum.Font.Cartoon
- BottomTextLabel.Text = "Touch Volleyball"
- BottomTextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- BottomTextLabel.TextScaled = true
- BottomTextLabel.TextStrokeTransparency = 0.8
- -- Function to teleport the ball
- local function teleportBall()
- local player = game.Players.LocalPlayer
- local character = player.Character
- local tennisCourt = game.Workspace:FindFirstChild("TennisCourt")
- if tennisCourt then
- local ball = tennisCourt:FindFirstChild("SoccerBall")
- if character and ball then
- local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
- if humanoidRootPart then
- -- Teleport the ball slightly in front of the HumanoidRootPart
- local offset = humanoidRootPart.CFrame.LookVector * 5 -- Move the ball 5 studs in front of the player
- ball.CFrame = humanoidRootPart.CFrame + offset
- end
- end
- end
- end
- -- Connect the button click to the teleport function
- TeleportButton.MouseButton1Click:Connect(teleportBall)