Advertisement
Scriptmasterrrueu

car crushers 2 speed script and core control

Dec 5th, 2024 (edited)
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.44 KB | Gaming | 0 0
  1. -- Services
  2. local CoreGui = game:GetService("StarterGui")
  3. local Players = game:GetService("Players")
  4. local Workspace = game:GetService("Workspace")
  5. local TweenService = game:GetService("TweenService")
  6. local UIS = game:GetService("UserInputService")
  7.  
  8. local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
  9.  
  10. -- Notify the player
  11. pcall(function()
  12.     CoreGui:SetCore("SendNotification", {
  13.         Title = "Car Crushers 2",
  14.         Text = "Speed script and core control loaded.",
  15.         Duration = 5,
  16.         Button1 = "OK",
  17.     })
  18. end)
  19.  
  20. -- UI Setup
  21. local function createUI()
  22.     local screenGui = Instance.new("ScreenGui")
  23.     screenGui.Name = "EnergyCoreUI"
  24.     screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  25.     screenGui.Parent = playerGui
  26.  
  27.     local infoFrame = Instance.new("Frame")
  28.     infoFrame.Name = "Info"
  29.     infoFrame.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
  30.     infoFrame.BorderSizePixel = 2
  31.     infoFrame.Position = UDim2.new(0.475, 0, 0.63, 0)
  32.     infoFrame.Size = UDim2.new(0, 254, 0, 145)
  33.     infoFrame.Visible = true
  34.     infoFrame.Parent = screenGui
  35.  
  36.     return screenGui, infoFrame
  37. end
  38.  
  39. local screenGui, infoFrame = createUI()
  40.  
  41. -- Utility Functions
  42. local function sendNotification(title, text, duration)
  43.     pcall(function()
  44.         CoreGui:SetCore("SendNotification", {
  45.             Title = title,
  46.             Text = text,
  47.             Duration = duration or 5,
  48.         })
  49.     end)
  50. end
  51.  
  52. local function updateStatusText(label, newText)
  53.     if label and typeof(label) == "Instance" and label:IsA("TextLabel") then
  54.         label.Text = newText
  55.     end
  56. end
  57.  
  58. local function toggleVisibility(frame, isVisible)
  59.     if frame and frame:IsA("GuiObject") then
  60.         frame.Visible = isVisible
  61.     end
  62. end
  63.  
  64. local function makeDraggable(frame)
  65.     local dragging = false
  66.     local dragStart, startPos
  67.  
  68.     frame.InputBegan:Connect(function(input)
  69.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  70.             dragging = true
  71.             dragStart = input.Position
  72.             startPos = frame.Position
  73.         end
  74.     end)
  75.  
  76.     frame.InputEnded:Connect(function(input)
  77.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  78.             dragging = false
  79.         end
  80.     end)
  81.  
  82.     UIS.InputChanged:Connect(function(input)
  83.         if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  84.             local delta = input.Position - dragStart
  85.             frame.Position = UDim2.new(
  86.                 startPos.X.Scale,
  87.                 startPos.X.Offset + delta.X,
  88.                 startPos.Y.Scale,
  89.                 startPos.Y.Offset + delta.Y
  90.             )
  91.         end
  92.     end)
  93. end
  94.  
  95. makeDraggable(infoFrame)
  96.  
  97. -- Dynamic Energy Status Handling
  98. local function getEnergyStatusText(status)
  99.     local statusTexts = {
  100.         ["FILLING"] = "Energy Status: Filling",
  101.         ["NOT FILLING"] = "Energy Status: Not Filling",
  102.         ["FULL"] = "Energy Status: Full",
  103.     }
  104.     return statusTexts[status] or "Energy Status: Unknown"
  105. end
  106.  
  107. local function updateEnergyStatus(energyLabel, energyCore)
  108.     if energyCore and typeof(energyCore) == "Instance" then
  109.         local status = energyCore:FindFirstChild("Status") and energyCore.Status.Value
  110.         local newText = getEnergyStatusText(status)
  111.         updateStatusText(energyLabel, newText)
  112.     else
  113.         updateStatusText(energyLabel, "Energy Core not found")
  114.     end
  115. end
  116.  
  117. -- Button Connections
  118. local function connectButton(button, action)
  119.     if button and button:IsA("TextButton") then
  120.         button.MouseButton1Click:Connect(action)
  121.     else
  122.         warn("Button not found or invalid")
  123.     end
  124. end
  125.  
  126. -- Energy Core Actions
  127. local function startEnergyCore()
  128.     local energyCore = Workspace:FindFirstChild("EnergyCore")
  129.     if energyCore then
  130.         sendNotification("Energy Core", "Filling started.")
  131.         -- Add logic to start filling the energy core
  132.     else
  133.         sendNotification("Error", "Energy Core not found.")
  134.     end
  135. end
  136.  
  137. -- Example Usage: Connecting Button to Action
  138. local exampleButton = Instance.new("TextButton")
  139. exampleButton.Name = "StartEnergy"
  140. exampleButton.Size = UDim2.new(0, 100, 0, 50)
  141. exampleButton.Position = UDim2.new(0.5, -50, 0.8, 0)
  142. exampleButton.Text = "Start Energy"
  143. exampleButton.Parent = infoFrame
  144.  
  145. connectButton(exampleButton, startEnergyCore)
  146.  
  147. -- Final Touch
  148. sendNotification("Energy Core Script", "UI and functionality loaded successfully.")
Tags: #robloxHacks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement