Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LocalScript
- -- User interface creation
- local player = game.Players.LocalPlayer
- local character = player.Character
- local humanoidRootPart = character and character:FindFirstChild("HumanoidRootPart")
- -- Check if the character and the "HumanoidRootPart" exist
- if not humanoidRootPart then
- warn("HumanoidRootPart not found in the character.")
- return
- end
- local screenGui = Instance.new("ScreenGui")
- local mainFrame = Instance.new("Frame")
- local nextButton = Instance.new("TextButton")
- local closeButton = Instance.new("TextButton")
- local titleLabel = Instance.new("TextLabel")
- -- Configure the ScreenGui
- screenGui.Name = "TeleportGui"
- screenGui.Parent = game:WaitForChild("CoreGui")
- screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- -- Configure the main Frame
- mainFrame.Name = "MainFrame"
- mainFrame.Parent = screenGui
- mainFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- mainFrame.BorderColor3 = Color3.fromRGB(110, 110, 110)
- mainFrame.Position = UDim2.new(0.321, 0, 0.283, 0)
- mainFrame.Size = UDim2.new(0, 350, 0, 200)
- mainFrame.Active = true
- mainFrame.Draggable = true
- -- Configure the button to advance to the next item
- nextButton.Name = "NextButton"
- nextButton.Parent = mainFrame
- nextButton.BackgroundColor3 = Color3.fromRGB(34, 34, 34)
- nextButton.BorderColor3 = Color3.fromRGB(84, 92, 38)
- nextButton.Position = UDim2.new(0.1, 0, 0.6, 0)
- nextButton.Size = UDim2.new(0, 280, 0, 50)
- nextButton.Font = Enum.Font.Gotham
- nextButton.Text = "Start Teleport"
- nextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- nextButton.TextSize = 15
- -- Configure the close button
- closeButton.Name = "CloseButton"
- closeButton.Parent = mainFrame
- closeButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- closeButton.BackgroundTransparency = 1
- closeButton.BorderSizePixel = 0
- closeButton.Position = UDim2.new(0.85, 0, 0, 0)
- closeButton.Size = UDim2.new(0, 40, 0, 40)
- closeButton.Font = Enum.Font.GothamBold
- closeButton.Text = "X"
- closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- closeButton.TextSize = 14
- -- Configure the label
- titleLabel.Name = "TitleLabel"
- titleLabel.Parent = mainFrame
- titleLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- titleLabel.BackgroundTransparency = 1
- titleLabel.BorderSizePixel = 0
- titleLabel.Position = UDim2.new(0.1, 0, 0, 0)
- titleLabel.Size = UDim2.new(0, 200, 0, 40)
- titleLabel.Font = Enum.Font.GothamBold
- titleLabel.Text = "Teleport through Drops"
- titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- titleLabel.TextSize = 16
- -- List of items in the "Drops" folder
- local dropsFolder = game.Workspace:FindFirstChild("Drops")
- local drops = dropsFolder and dropsFolder:GetChildren() or {}
- local currentDropIndex = 1
- local teleporting = false
- -- Function to teleport the player to the current item
- local function teleportToCurrentDrop()
- if #drops > 0 and currentDropIndex <= #drops then
- local drop = drops[currentDropIndex]
- if drop:IsA("BasePart") then
- humanoidRootPart.CFrame = CFrame.new(drop.Position)
- end
- end
- end
- -- Function to start automatic teleportation
- local function startAutomaticTeleport()
- teleporting = true
- while teleporting do
- teleportToCurrentDrop()
- wait(2) -- Wait 2 seconds before moving to the next item
- currentDropIndex = currentDropIndex + 1
- if currentDropIndex > #drops then
- currentDropIndex = 1 -- Return to the first item if finished
- end
- end
- end
- -- Connect the button to start automatic teleportation
- nextButton.MouseButton1Click:Connect(function()
- if not teleporting then
- startAutomaticTeleport()
- end
- end)
- -- Connect the close button
- closeButton.MouseButton1Click:Connect(function()
- screenGui:Destroy()
- teleporting = false
- end)
- -- Teleport to the first item on initialization
- teleportToCurrentDrop()
Advertisement
Add Comment
Please, Sign In to add comment