Advertisement
PC55654

Carry Me Script

Sep 12th, 2023 (edited)
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.42 KB | Source Code | 0 0
  1.     local textGui = Instance.new("ScreenGui")
  2.     textGui.Name = "TextLabelGui"
  3.     textGui.ResetOnSpawn = false  
  4.     textGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  5.  
  6.     local textGui = Instance.new("ScreenGui")
  7. textGui.Name = "TextLabelGui"
  8. textGui.ResetOnSpawn = false
  9. textGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  10.  
  11. local messages = {
  12.     "Thanks For Using My Script",
  13.     "Made By Unknown_GAMER",
  14.     "Loadeding"
  15. }
  16.  
  17. for i, message in ipairs(messages) do
  18.     local textLabel = Instance.new("TextLabel")
  19.     textLabel.Size = UDim2.new(0, 250, 0, 40)
  20.     textLabel.Position = UDim2.new(0.1, -130, 1, -50)
  21.     textLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  22.     textLabel.BackgroundTransparency = 0.6  
  23.     textLabel.BorderSizePixel = 0
  24.     textLabel.Text = message
  25.     textLabel.TextColor3 = Color3.new(1, 1, 1)
  26.     textLabel.Font = Enum.Font.SourceSansBold
  27.     textLabel.TextSize = 24
  28.     textLabel.Parent = textGui
  29.     wait(3)
  30.     textLabel:Destroy()
  31.    end
  32.  
  33. wait(1)
  34.  
  35. local screenGui = Instance.new("ScreenGui")
  36. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  37.  
  38.  
  39. local frame = Instance.new("Frame")
  40. frame.Name = "TeleportFrame"
  41. frame.Size = UDim2.new(0, 200, 0, 300)
  42. frame.Position = UDim2.new(0.5, -100, 0.5, -150)
  43. frame.BackgroundTransparency = 0.5  
  44. frame.BackgroundColor3 = Color3.new(0, 0, 0)
  45. frame.Parent = screenGui
  46.  
  47.  
  48. local toggleScreenGui = Instance.new("ScreenGui")
  49. toggleScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  50.  
  51.  
  52. local toggleButton = Instance.new("TextButton")
  53. toggleButton.Name = "ToggleFrameButton"
  54. toggleButton.Text = "Open"
  55. toggleButton.Size = UDim2.new(0, 100, 0, 30)
  56. toggleButton.Position = UDim2.new(0.5, -50, 0, 10)
  57. toggleButton.Parent = toggleScreenGui
  58.  
  59.  
  60. local isFrameVisible = true
  61.  
  62.  
  63. local function toggleFrameVisibility()
  64.     isFrameVisible = not isFrameVisible
  65.     frame.Visible = isFrameVisible
  66.  
  67.  
  68.     toggleButton.Text = isFrameVisible and "Close" or "Open"
  69. end
  70.  
  71.  
  72. toggleButton.MouseButton1Click:Connect(toggleFrameVisibility)
  73.  
  74.  
  75. local dragging
  76. local dragInput
  77. local dragStart
  78. local startPos
  79.  
  80. frame.InputBegan:Connect(function(input)
  81.     if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  82.         dragging = true
  83.         dragStart = input.Position
  84.         startPos = frame.Position
  85.  
  86.         input.Changed:Connect(function()
  87.             if input.UserInputState == Enum.UserInputState.End then
  88.                 dragging = false
  89.             end
  90.         end)
  91.     end
  92. end)
  93.  
  94. frame.InputChanged:Connect(function(input)
  95.     if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  96.         dragInput = input
  97.     end
  98. end)
  99.  
  100. game:GetService("UserInputService").InputChanged:Connect(function(input)
  101.     if dragging and input == dragInput then
  102.         local delta = input.Position - dragStart
  103.         frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  104.     end
  105. end)
  106.  
  107.  
  108. local checkpointNames = {
  109.     "checkpoint1",
  110.     "checkpoint2",
  111.     "checkpoint3",
  112.     "checkpoint4",
  113.     "checkpoint5",
  114.     "checkpoint6",
  115.     "checkpoint7"
  116. }
  117.  
  118.  
  119. for i, checkpointName in ipairs(checkpointNames) do
  120.     local button = Instance.new("TextButton")
  121.     button.Name = "TeleportButton" .. i
  122.     button.Text = "Teleport to " .. checkpointName
  123.     button.Size = UDim2.new(0, 180, 0, 40)
  124.     button.Position = UDim2.new(0, 10, 0, 50 * (i - 1))
  125.     button.Parent = frame
  126.  
  127.    
  128.     button.TextScaled = true
  129.  
  130.    
  131.     local function teleportPlayer()
  132.      
  133.         local player = game.Players.LocalPlayer
  134.  
  135.        
  136.         if player then
  137.            
  138.             local character = player.Character
  139.  
  140.            
  141.             if character and character:FindFirstChild("Humanoid") and character.Humanoid.Health > 0 then
  142.                
  143.                 local checkpointPart = game.Workspace:WaitForChild("Checkpoints"):FindFirstChild(checkpointName)
  144.  
  145.                
  146.                 if checkpointPart then
  147.                    
  148.                     character:MoveTo(checkpointPart.Position)
  149.                 else
  150.                     print("Checkpoint part " .. checkpointName .. " not found.")
  151.                 end
  152.             end
  153.         end
  154.     end
  155.  
  156.  
  157.     button.MouseButton1Click:Connect(teleportPlayer)
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement