Ramen_Sukuna

ObbyButYoureATruckScript

Nov 10th, 2024
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.78 KB | Gaming | 0 0
  1. -- Create ScreenGui for Loading Screen
  2. local screenGui = Instance.new("ScreenGui")
  3. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  4. screenGui.ResetOnSpawn = false
  5.  
  6. -- Create Frame for Loading Screen
  7. local frame = Instance.new("Frame")
  8. frame.Parent = screenGui
  9. frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  10. frame.Size = UDim2.new(0, 300, 0, 200)  -- Increased size for better readability
  11. frame.Position = UDim2.new(0.5, -150, 0.5, -100)
  12. frame.BorderSizePixel = 2
  13. frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  14.  
  15. -- Create "Loading" Text
  16. local loadingLabel = Instance.new("TextLabel")
  17. loadingLabel.Parent = frame
  18. loadingLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  19. loadingLabel.Size = UDim2.new(0, 200, 0, 30)
  20. loadingLabel.Position = UDim2.new(0.5, -100, 0, 20)  -- Positioned at the top of the progress bar
  21. loadingLabel.Text = "Loading"
  22. loadingLabel.TextScaled = true
  23. loadingLabel.TextColor3 = Color3.fromRGB(255, 165, 0)
  24. loadingLabel.TextXAlignment = Enum.TextXAlignment.Center
  25. loadingLabel.TextYAlignment = Enum.TextYAlignment.Center
  26. loadingLabel.BackgroundTransparency = 1  -- Make the background transparent
  27.  
  28. -- Create Label for Message
  29. local messageLabel = Instance.new("TextLabel")
  30. messageLabel.Parent = frame
  31. messageLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  32. messageLabel.Size = UDim2.new(0, 160, 0, 30)
  33. messageLabel.Position = UDim2.new(0.5, -80, 0.8, 0)
  34. messageLabel.Text = "Made with effort By Ramen Sukuna 🍜"
  35. messageLabel.TextScaled = true
  36. messageLabel.TextColor3 = Color3.fromRGB(255, 165, 0)  -- Orange text color
  37. messageLabel.TextXAlignment = Enum.TextXAlignment.Center
  38. messageLabel.TextYAlignment = Enum.TextYAlignment.Center
  39. messageLabel.BackgroundTransparency = 1  -- Make the background transparent
  40.  
  41. -- Create Progress Bar
  42. local progressBar = Instance.new("Frame")
  43. progressBar.Parent = frame
  44. progressBar.BackgroundColor3 = Color3.fromRGB(255, 165, 0)  -- Orange color
  45. progressBar.Size = UDim2.new(0, 0, 0, 20)  -- Start with 0 width
  46. progressBar.Position = UDim2.new(0.5, -0, 0, 100)  -- Centered horizontally and vertically below the text
  47. progressBar.AnchorPoint = Vector2.new(0.5, 0.5)  -- Center the bar within the frame
  48.  
  49. -- Function to simulate loading
  50. local function startLoading()
  51.     local elapsedTime = 0
  52.     local loadingDuration = 10  -- Duration for loading in seconds
  53.     
  54.     -- Update the loading bar over time
  55.     while elapsedTime < loadingDuration do
  56.         local progress = elapsedTime / loadingDuration
  57.         progressBar.Size = UDim2.new(progress, 0, 0, 20)  -- Adjust progress bar size
  58.         elapsedTime = elapsedTime + wait(0.1)
  59.     end
  60.  
  61.     -- Once the progress bar is filled, destroy the ScreenGui
  62.     screenGui:Destroy()  -- Destroy the entire loading screen immediately after the progress bar finishes
  63.  
  64.     -- The rest of your code can be placed here to run after the loading is complete
  65.     -- For example:
  66.     print("Loading complete! Now proceeding with the main script...")
  67.     -- You can place your further actions or UI creation code here
  68. end
  69.  
  70. -- Start the loading process
  71. startLoading()
  72.  
  73. -- Create ScreenGui
  74. local screenGui = Instance.new("ScreenGui")
  75. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  76. screenGui.ResetOnSpawn = false
  77.  
  78. -- Create Frame
  79. local frame = Instance.new("Frame")
  80. frame.Parent = screenGui
  81. frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  82. frame.Size = UDim2.new(0, 200, 0, 150)
  83. frame.Position = UDim2.new(0.5, -100, 0.5, -75)
  84. frame.Active = true
  85. frame.Draggable = true
  86. frame.BorderSizePixel = 2
  87. frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  88.  
  89. -- Create Play Button (formerly On Button)
  90. local onButton = Instance.new("TextButton")
  91. onButton.Parent = frame
  92. onButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  93. onButton.Size = UDim2.new(0, 60, 0, 30)
  94. onButton.Position = UDim2.new(0, 20, 0, 20)
  95. onButton.Text = "Play"  -- Changed text from "On" to "Play"
  96. onButton.TextScaled = true
  97. onButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  98.  
  99. -- Create Stop Button (formerly Off Button)
  100. local offButton = Instance.new("TextButton")
  101. offButton.Parent = frame
  102. offButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  103. offButton.Size = UDim2.new(0, 60, 0, 30)
  104. offButton.Position = UDim2.new(0, 120, 0, 20)
  105. offButton.Text = "Stop"  -- Changed text from "Off" to "Stop"
  106. offButton.TextScaled = true
  107. offButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  108.  
  109. -- Replace the Destroy button with a Label
  110. local byRamenSukunaLabel = Instance.new("TextLabel")
  111. byRamenSukunaLabel.Parent = frame
  112. byRamenSukunaLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  113. byRamenSukunaLabel.Size = UDim2.new(0, 160, 0, 30)
  114. byRamenSukunaLabel.Position = UDim2.new(0, 20, 0, 60)
  115. byRamenSukunaLabel.Text = "By Ramen Sukuna 🍜"
  116. byRamenSukunaLabel.TextScaled = true
  117. byRamenSukunaLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  118. byRamenSukunaLabel.TextXAlignment = Enum.TextXAlignment.Center
  119. byRamenSukunaLabel.TextYAlignment = Enum.TextYAlignment.Center
  120. byRamenSukunaLabel.BackgroundTransparency = 1  -- Makes it just text
  121.  
  122. -- Create Status Indicator
  123. local statusLabel = Instance.new("TextLabel")
  124. statusLabel.Parent = frame
  125. statusLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  126. statusLabel.Size = UDim2.new(0, 200, 0, 30)
  127. statusLabel.Position = UDim2.new(0, 0, 0, -30)
  128. statusLabel.Text = "Status: Off"
  129. statusLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
  130. statusLabel.TextScaled = true
  131. statusLabel.TextXAlignment = Enum.TextXAlignment.Center
  132.  
  133. -- Create "X" Button inside the Frame to destroy the GUI
  134. local closeButton = Instance.new("TextButton")
  135. closeButton.Parent = frame
  136. closeButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)  -- Red background
  137. closeButton.Size = UDim2.new(0, 30, 0, 30)  -- Small button size
  138. closeButton.Position = UDim2.new(1, -35, 0, 5)  -- Position inside the frame, top-right with padding
  139. closeButton.Text = "X"
  140. closeButton.TextScaled = true
  141. closeButton.TextColor3 = Color3.fromRGB(0, 0, 0)  -- Black text
  142. closeButton.BorderSizePixel = 0  -- No border
  143.  
  144. -- Function to close the GUI when "X" is clicked
  145. closeButton.MouseButton1Click:Connect(function()
  146.     screenGui:Destroy()  -- Destroy the ScreenGui
  147. end)
  148.  
  149. -- Variable to store platform and follow connection
  150. local platform
  151. local followConnection
  152. local isPlatformActive = false  -- Track platform status
  153.  
  154. -- Function to create platform
  155. local function createPlatform()
  156.     local player = game.Players.LocalPlayer
  157.     if not player or not player.Character then return end
  158.     
  159.     local character = player.Character
  160.     local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  161.     
  162.     -- Create a new part (platform)
  163.     platform = Instance.new("Part")
  164.     platform.Size = Vector3.new(40, 1, 40)  -- Size of the platform
  165.     platform.Anchored = true
  166.     platform.Color = Color3.fromRGB(255, 255, 255)  -- Red color
  167.     platform.Parent = workspace
  168.     
  169.     -- Follow the character's position
  170.     followConnection = game:GetService("RunService").Heartbeat:Connect(function()
  171.         if character and humanoidRootPart then
  172.             platform.Position = humanoidRootPart.Position - Vector3.new(0, 6.98, 0)
  173.         end
  174.     end)
  175.     
  176.     -- Update status and button state
  177.     statusLabel.Text = "Status: On"
  178.     statusLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
  179.     isPlatformActive = true
  180. end
  181.  
  182. -- Function to remove platform
  183. local function removePlatform()
  184.     if platform then
  185.         platform:Destroy()
  186.         platform = nil
  187.     end
  188.     if followConnection then
  189.         followConnection:Disconnect()
  190.         followConnection = nil
  191.     end
  192.     
  193.     -- Update status and button state
  194.     statusLabel.Text = "Status: Off"
  195.     statusLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
  196.     isPlatformActive = false
  197. end
  198.  
  199. -- Button Functions
  200. onButton.MouseButton1Click:Connect(function()
  201.     if not isPlatformActive then
  202.         createPlatform()
  203.     end
  204. end)
  205.  
  206. offButton.MouseButton1Click:Connect(function()
  207.     if isPlatformActive then
  208.         removePlatform()
  209.     end
  210. end)
  211.  
  212. -- Button Hover Effects (optional, to enhance UX)
  213. local function onButtonHover(button, hover)
  214.     button.BackgroundColor3 = hover and Color3.fromRGB(0, 200, 0) or Color3.fromRGB(0, 255, 0)
  215. end
  216.  
  217. local function offButtonHover(button, hover)
  218.     button.BackgroundColor3 = hover and Color3.fromRGB(200, 0, 0) or Color3.fromRGB(255, 0, 0)
  219. end
  220.  
  221. onButton.MouseEnter:Connect(function() onButtonHover(onButton, true) end)
  222. onButton.MouseLeave:Connect(function() onButtonHover(onButton, false) end)
  223.  
  224. offButton.MouseEnter:Connect(function() offButtonHover(offButton, true) end)
  225. offButton.MouseLeave:Connect(function() offButtonHover(offButton, false) end)
Tags: Roblox obby
Advertisement
Add Comment
Please, Sign In to add comment