--[[ Xdemic Control - Brookhaven Mobile Features: W/S Logic, 0-200% Sensei Slider, Speedometer, Toggle & Destroy --]] local Player = game:GetService("Players").LocalPlayer local RunService = game:GetService("RunService") local CoreGui = game:GetService("CoreGui") local UIS = game:GetService("UserInputService") -- CLEANUP OLD SCRIPT local function Cleanup() local old = CoreGui:FindFirstChild("XdemicControlUI") or Player.PlayerGui:FindFirstChild("XdemicControlUI") if old then old:Destroy() end end Cleanup() -- CORE UI local ScreenGui = Instance.new("ScreenGui", CoreGui or Player.PlayerGui) ScreenGui.Name = "XdemicControlUI" ScreenGui.ResetOnSpawn = false local MainFrame = Instance.new("Frame", ScreenGui) MainFrame.Name = "MainFrame" MainFrame.Size = UDim2.new(1, 0, 1, 0) MainFrame.BackgroundTransparency = 1 -- BUTTON CREATOR local function createBtn(name, text, pos, size, color) local b = Instance.new("TextButton", MainFrame) b.Name = name; b.Text = text; b.Position = pos b.Size = size or UDim2.new(0, 120, 0, 100) b.BackgroundColor3 = color or Color3.fromRGB(30, 30, 30) b.BackgroundTransparency = 0.2 b.TextColor3 = Color3.new(1, 1, 1) b.Font = Enum.Font.GothamBold; b.TextSize = 25 Instance.new("UICorner", b).CornerRadius = UDim.new(0, 15) return b end -- 1. DRIVING CONTROLS (W/S Logic) local Gas = createBtn("Gas", "W", UDim2.new(0.82, 0, 0.48, 0), UDim2.new(0, 140, 0, 110), Color3.fromRGB(0, 180, 0)) local Rev = createBtn("Rev", "S", UDim2.new(0.82, 0, 0.75, 0), UDim2.new(0, 140, 0, 110), Color3.fromRGB(70, 70, 70)) local Left = createBtn("Left", "A", UDim2.new(0.05, 0, 0.70, 0)) local Right = createBtn("Right", "D", UDim2.new(0.18, 0, 0.70, 0)) local Brake = createBtn("Brake", "STOP", UDim2.new(0.70, 0, 0.65, 0), UDim2.new(0, 90, 0, 90), Color3.fromRGB(220, 0, 0)) -- 2. MANAGEMENT BUTTONS (Close/Destroy) local HideBtn = createBtn("Hide", "CLOSE UI", UDim2.new(0.38, 0, 0.05, 0), UDim2.new(0, 110, 0, 45), Color3.fromRGB(50, 50, 50)) HideBtn.TextSize = 15 local DestroyBtn = createBtn("Destroy", "DESTROY", UDim2.new(0.50, 0, 0.05, 0), UDim2.new(0, 110, 0, 45), Color3.fromRGB(150, 0, 0)) DestroyBtn.TextSize = 15 -- 3. SPEEDOMETER local SpeedLabel = Instance.new("TextLabel", MainFrame) SpeedLabel.Size = UDim2.new(0, 180, 0, 50); SpeedLabel.Position = UDim2.new(0.42, 0, 0.88, 0) SpeedLabel.BackgroundColor3 = Color3.new(0,0,0); SpeedLabel.BackgroundTransparency = 0.5 SpeedLabel.TextColor3 = Color3.new(0,1,1); SpeedLabel.TextSize = 22; SpeedLabel.Font = Enum.Font.Code SpeedLabel.Text = "MPH: 0" Instance.new("UICorner", SpeedLabel) -- 4. SENSEI SLIDER local SliderBG = Instance.new("Frame", MainFrame) SliderBG.Size = UDim2.new(0, 220, 0, 12); SliderBG.Position = UDim2.new(0.05, 0, 0.62, 0) SliderBG.BackgroundColor3 = Color3.fromRGB(80, 80, 80) local SliderBtn = Instance.new("TextButton", SliderBG) SliderBtn.Size = UDim2.new(0, 28, 0, 28); SliderBtn.Position = UDim2.new(0.5, -14, 0.5, -14); SliderBtn.Text = "" Instance.new("UICorner", SliderBtn).CornerRadius = UDim.new(1, 0) local SliderText = Instance.new("TextLabel", SliderBG) SliderText.Size = UDim2.new(1,0,0,20); SliderText.Position = UDim2.new(0,0,-2.8,0); SliderText.TextColor3 = Color3.new(1,1,1) SliderText.Text = "Xdemic Sensei: 100%"; SliderText.BackgroundTransparency = 1; SliderText.Font = Enum.Font.GothamBold -- LOGIC ENGINE local throttle, steer, sensei = 0, 0, 1.0 local dragging = false SliderBtn.InputBegan:Connect(function(i) if i.UserInputType == Enum.UserInputType.Touch or i.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true end end) UIS.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.Touch or i.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) RunService.RenderStepped:Connect(function() if dragging then local mousePos = UIS:GetMouseLocation().X local rel = math.clamp((mousePos - SliderBG.AbsolutePosition.X) / SliderBG.AbsoluteSize.X, 0, 1) SliderBtn.Position = UDim2.new(rel, -14, 0.5, -14) sensei = rel * 2 SliderText.Text = "Xdemic Sensei: " .. math.floor(sensei * 100) .. "%" end local seat = Player.Character and Player.Character:FindFirstChild("Humanoid") and Player.Character.Humanoid.SeatPart if seat and seat:IsA("VehicleSeat") then seat.ThrottleFloat = throttle seat.SteerFloat = steer * sensei SpeedLabel.Text = "MPH: " .. math.floor(seat.AssemblyLinearVelocity.Magnitude * 0.75) else SpeedLabel.Text = "SIT IN CAR" end end) -- INPUT MAPPING Gas.MouseButton1Down:Connect(function() throttle = 1 end) Gas.MouseButton1Up:Connect(function() throttle = 0 end) Rev.MouseButton1Down:Connect(function() throttle = -1 end) Rev.MouseButton1Up:Connect(function() throttle = 0 end) Left.MouseButton1Down:Connect(function() steer = -1 end) Left.MouseButton1Up:Connect(function() steer = 0 end) Right.MouseButton1Down:Connect(function() steer = 1 end) Right.MouseButton1Up:Connect(function() steer = 0 end) Brake.MouseButton1Down:Connect(function() throttle = 0; steer = 0 end) -- UI TOGGLES HideBtn.MouseButton1Click:Connect(function() MainFrame.Visible = not MainFrame.Visible HideBtn.Text = MainFrame.Visible and "CLOSE UI" or "OPEN UI" end) DestroyBtn.MouseButton1Click:Connect(function() ScreenGui:Destroy() end)