Advertisement
PC55654

Altitorture

Sep 14th, 2023 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.79 KB | Source Code | 0 0
  1. -- Create a welcome message using TextLabels
  2. local textGui = Instance.new("ScreenGui")
  3. textGui.Name = "TextLabelGui"
  4. textGui.ResetOnSpawn = false  
  5. textGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  6.  
  7. local messages = {
  8.     "Thanks For Using My Script",
  9.     "Made By Unknown_GAMER",
  10.     "Loading"
  11. }
  12.  
  13. for _, message in ipairs(messages) do
  14.     local textLabel = Instance.new("TextLabel")
  15.     textLabel.Size = UDim2.new(0, 250, 0, 40)
  16.     textLabel.Position = UDim2.new(0.1, -130, 1, -50)
  17.     textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  18.     textLabel.BackgroundTransparency = 0.6  
  19.     textLabel.BorderSizePixel = 0
  20.     textLabel.Text = message
  21.     textLabel.TextColor3 = Color3.new(1, 1, 1)
  22.     textLabel.Font = Enum.Font.SourceSansBold
  23.     textLabel.TextSize = 24
  24.     textLabel.Parent = textGui
  25.     wait(3)
  26.     textLabel:Destroy()
  27. end
  28.  
  29. wait(1)
  30.  
  31. -- Create a ScreenGui for the teleport frame
  32. local screenGui = Instance.new("ScreenGui")
  33. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  34.  
  35. -- Create a frame for teleporting
  36. local frame = Instance.new("Frame")
  37. frame.Name = "TeleportFrame"
  38. frame.Size = UDim2.new(0, 200, 0, 300)
  39. frame.Position = UDim2.new(0.5, -100, 0.5, -150)
  40. frame.BackgroundTransparency = 0.5  
  41. frame.BackgroundColor3 = Color3.new(0, 0, 0)
  42. frame.Parent = screenGui
  43.  
  44. -- Create a ScreenGui for the toggle button
  45. local toggleScreenGui = Instance.new("ScreenGui")
  46. toggleScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  47.  
  48. -- Create a button for toggling the frame
  49. local toggleButton = Instance.new("TextButton")
  50. toggleButton.Name = "ToggleFrameButton"
  51. toggleButton.Text = "Open"
  52. toggleButton.Size = UDim2.new(0, 100, 0, 30)
  53. toggleButton.Position = UDim2.new(0.039, -50, 0.82, 10)
  54. toggleButton.Parent = toggleScreenGui
  55.  
  56. local isFrameVisible = true
  57.  
  58. -- Function to toggle the frame's visibility
  59. local function toggleFrameVisibility()
  60.     isFrameVisible = not isFrameVisible
  61.     frame.Visible = isFrameVisible
  62.     toggleButton.Text = isFrameVisible and "Close" or "Open"
  63. end
  64.  
  65. toggleButton.MouseButton1Click:Connect(toggleFrameVisibility)
  66.  
  67. local dragging
  68. local dragInput
  69. local dragStart
  70. local startPos
  71.  
  72. -- Function to handle mouse button press
  73. frame.InputBegan:Connect(function(input)
  74.     if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  75.         dragging = true
  76.         dragStart = input.Position
  77.         startPos = frame.Position
  78.  
  79.         input.Changed:Connect(function()
  80.             if input.UserInputState == Enum.UserInputState.End then
  81.                 dragging = false
  82.             end
  83.         end)
  84.     end
  85. end)
  86.  
  87. -- Function to handle mouse movement
  88. frame.InputChanged:Connect(function(input)
  89.     if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  90.         dragInput = input
  91.     end
  92. end)
  93.  
  94. -- Function to update frame position while dragging
  95. game:GetService("UserInputService").InputChanged:Connect(function(input)
  96.     if dragging and input == dragInput then
  97.         local delta = input.Position - dragStart
  98.         frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  99.     end
  100. end)
  101.  
  102. -- Folder for your checkpoints (place your parts inside)
  103. local checkpointsFolder = game.Workspace:WaitForChild("CHECKPOINTS")
  104.  
  105. -- Array of checkpoint names
  106. local checkpointNames = {
  107.     "0",
  108.     "100",
  109.     "200",
  110.     "300",
  111.     "400"
  112. }
  113.  
  114. -- Function to teleport the player to a checkpoint
  115. local function teleportPlayer(checkpointName)
  116.     local player = game.Players.LocalPlayer
  117.  
  118.     if player then
  119.         local character = player.Character
  120.  
  121.         if character and character:FindFirstChild("Humanoid") and character.Humanoid.Health > 0 then
  122.             if checkpointsFolder then
  123.                 local checkpointFolder = checkpointsFolder:FindFirstChild(checkpointName)
  124.  
  125.                 if checkpointFolder then
  126.                     local checkpointPart = checkpointFolder:FindFirstChild("DetectorPart")
  127.  
  128.                     if checkpointPart then
  129.                         character:SetPrimaryPartCFrame(CFrame.new(checkpointPart.Position))
  130.                     else
  131.                         print("Checkpoint part not found in folder " .. checkpointFolder.Name)
  132.                     end
  133.                 else
  134.                     print("Checkpoint folder " .. checkpointName .. " not found.")
  135.                 end
  136.             else
  137.                 print("CHECKPOINTS folder not found in Workspace.")
  138.             end
  139.         end
  140.     end
  141. end
  142.  
  143. -- Create buttons for teleporting to checkpoints
  144. for i, checkpointName in ipairs(checkpointNames) do
  145.     local button = Instance.new("TextButton")
  146.     button.Name = "TeleportButton" .. i
  147.     button.Text = "Teleport to " .. checkpointName
  148.     button.Size = UDim2.new(0, 180, 0, 40)
  149.     button.Position = UDim2.new(0, 10, 0, 50 * (i - 1))
  150.     button.Parent = frame
  151.     button.TextScaled = true
  152.  
  153.     button.MouseButton1Click:Connect(function()
  154.         teleportPlayer(checkpointName)
  155.     end)
  156. end
  157.  
  158. -- Create a button for teleporting to all checkpoints
  159. local teleportAllButton = Instance.new("TextButton")
  160. teleportAllButton.Name = "TeleportAllButton"
  161. teleportAllButton.Text = "Instant Teleport"
  162. teleportAllButton.Size = UDim2.new(0, 180, 0, 40)
  163. teleportAllButton.Position = UDim2.new(0, 10, 0, 250) -- Adjust the position as needed
  164. teleportAllButton.Parent = frame
  165. teleportAllButton.TextScaled = true
  166.  
  167. -- Function to teleport the player to all checkpoints one by one
  168. local function teleportToAllCheckpoints()
  169.     local player = game.Players.LocalPlayer
  170.  
  171.     if player then
  172.         local character = player.Character
  173.  
  174.         if character and character:FindFirstChild("Humanoid") and character.Humanoid.Health > 0 then
  175.             if checkpointsFolder then
  176.                 for _, checkpointFolder in pairs(checkpointsFolder:GetChildren()) do
  177.                     if checkpointFolder:IsA("Folder") then
  178.                         local checkpointPart = checkpointFolder:FindFirstChild("DetectorPart")
  179.  
  180.                         if checkpointPart then
  181.                             character:SetPrimaryPartCFrame(CFrame.new(checkpointPart.Position))
  182.                             wait(1) -- Wait for 1 second between teleports
  183.                         else
  184.                             print("Checkpoint part not found in folder " .. checkpointFolder.Name)
  185.                         end
  186.                     end
  187.                 end
  188.             else
  189.                 print("CHECKPOINTS folder not found in Workspace.")
  190.             end
  191.         end
  192.     end
  193. end
  194.  
  195. -- Connect the teleportAllButton to the teleportToAllCheckpoints function
  196. teleportAllButton.MouseButton1Click:Connect(teleportToAllCheckpoints)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement