--==========================================================================================-- -- MANKI 2K - STUNT SYSTEM WITH BIND EDITOR + FIXED MOBILE BUTTONS --==========================================================================================-- -- === BINDS (editable via GUI) === local BINDS = { STOPPIE = Enum.KeyCode.H, WHEELIE = Enum.KeyCode.P, JUMP = Enum.KeyCode.C } -- === PARAMETERS === local ANGLE_STOPPIE = 43 local ANGLE_WHEELIE = 40 local TURN_SPEED = 2.5 local JUMP_POWER = 50 local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local CoreGui = game:GetService("CoreGui") local LocalPlayer = Players.LocalPlayer local activeStunt = nil local mainConnection = nil local lockedSpeedMagnitude = 0 local currentHeadingAngle = 0 local originalMaterials = {} local waitingForBind = nil local mobileButtonsVisible = false local mobileButtonContainer = nil -- === HELPER FUNCTIONS === local function getBikeElements() local character = LocalPlayer.Character if not character then return nil, nil end local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoid or not humanoid.Sit then return nil, nil end local seat = humanoid.SeatPart if seat and seat:IsA("VehicleSeat") then pcall(function() if setnetworkowner then setnetworkowner(seat, LocalPlayer) end end) end local bike = character:FindFirstChildOfClass("Model") or game.Workspace:FindFirstChild(LocalPlayer.Name .. "'s Bike") return seat, bike end local function toggleFriction(disable) local _, bike = getBikeElements() if not bike then return end for _, part in pairs(bike:GetDescendants()) do if part:IsA("BasePart") and (string.find(string.lower(part.Name), "wheel") or string.find(string.lower(part.Name), "tire")) then if disable then if not originalMaterials[part] then originalMaterials[part] = part.CustomPhysicalProperties or PhysicalProperties.new(part.Material) end part.CustomPhysicalProperties = PhysicalProperties.new(0.7, 0, 0, 1, 1) else if originalMaterials[part] then part.CustomPhysicalProperties = originalMaterials[part] end end end end end local function stopAllStunts() if mainConnection then mainConnection:Disconnect() mainConnection = nil end toggleFriction(false) originalMaterials = {} lockedSpeedMagnitude = 0 currentHeadingAngle = 0 activeStunt = nil local seat, _ = getBikeElements() if seat and seat:IsA("VehicleSeat") then seat.AssemblyAngularVelocity = Vector3.new(0, 0, 0) end print("[Stunt System]: Physics fully restored.") end -- === STUNT LOGIC === local function processStuntLogic(deltaTime) if not activeStunt then return end local seat, _ = getBikeElements() if not seat or not seat:IsA("VehicleSeat") then stopAllStunts() return end if UserInputService:IsKeyDown(Enum.KeyCode.A) or UserInputService:IsKeyDown(Enum.KeyCode.Left) then currentHeadingAngle = currentHeadingAngle + (TURN_SPEED * deltaTime) elseif UserInputService:IsKeyDown(Enum.KeyCode.D) or UserInputService:IsKeyDown(Enum.KeyCode.Right) then currentHeadingAngle = currentHeadingAngle - (TURN_SPEED * deltaTime) end local baseCFrame = CFrame.Angles(0, currentHeadingAngle, 0) local flatLook = baseCFrame.LookVector.Unit local targetRadX = 0 if activeStunt == "Stoppie" then targetRadX = math.rad(-ANGLE_STOPPIE) elseif activeStunt == "Wheelie" then targetRadX = math.rad(ANGLE_WHEELIE) end seat.CFrame = CFrame.new(seat.Position) * CFrame.Angles(0, currentHeadingAngle, 0) * CFrame.Angles(targetRadX, 0, 0) local currentYVelocity = seat.AssemblyLinearVelocity.Y seat.AssemblyLinearVelocity = Vector3.new(flatLook.X * lockedSpeedMagnitude, currentYVelocity, flatLook.Z * lockedSpeedMagnitude) seat.AssemblyAngularVelocity = Vector3.new(0, 0, 0) end -- === ДЕЙСТВИЯ === local function toggleWheelie() local seat, _ = getBikeElements() if not seat then return end if activeStunt == "Wheelie" then stopAllStunts() elseif activeStunt == nil then activeStunt = "Wheelie" print("[Stunt System]: WHEELIE activated.") local _, y, _ = seat.CFrame:ToEulerAnglesXYZ() currentHeadingAngle = y local speed = seat.AssemblyLinearVelocity.Magnitude lockedSpeedMagnitude = math.clamp(speed, 45, 80) toggleFriction(true) mainConnection = RunService.Heartbeat:Connect(processStuntLogic) end end local function toggleStoppie() local seat, _ = getBikeElements() if not seat then return end if activeStunt == "Stoppie" then stopAllStunts() elseif activeStunt == nil then activeStunt = "Stoppie" print("[Stunt System]: STOPPIE activated.") local _, y, _ = seat.CFrame:ToEulerAnglesXYZ() currentHeadingAngle = y local speed = seat.AssemblyLinearVelocity.Magnitude lockedSpeedMagnitude = math.clamp(speed, 45, 80) toggleFriction(true) mainConnection = RunService.Heartbeat:Connect(processStuntLogic) end end local function doJump() local seat, _ = getBikeElements() if not seat then return end seat.AssemblyLinearVelocity = Vector3.new(seat.AssemblyLinearVelocity.X, JUMP_POWER, seat.AssemblyLinearVelocity.Z) print("[Stunt System]: Jump!") end -- === INPUT HANDLER (клавиши) === UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if waitingForBind then return end local seat, _ = getBikeElements() if not seat then return end if input.KeyCode == BINDS.JUMP then doJump() elseif input.KeyCode == BINDS.STOPPIE then toggleStoppie() elseif input.KeyCode == BINDS.WHEELIE then toggleWheelie() end end) -- === BIND CHANGE HANDLER === UserInputService.InputBegan:Connect(function(input, gameProcessed) if not waitingForBind then return end if gameProcessed then return end if input.KeyCode == Enum.KeyCode.Unknown then return end if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift or input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.RightControl or input.KeyCode == Enum.KeyCode.LeftAlt or input.KeyCode == Enum.KeyCode.RightAlt then return end BINDS[waitingForBind] = input.KeyCode print("[Stunt System]: Bind for " .. waitingForBind .. " changed to " .. tostring(input.KeyCode)) waitingForBind = nil createStuntMenu() end) LocalPlayer.CharacterRemoving:Connect(stopAllStunts) --==========================================================================================-- -- ФУНКЦИЯ СОЗДАНИЯ МОБИЛЬНЫХ КНОПОК (исправленная) --==========================================================================================-- function createMobileButtons(parentGui) -- Если кнопки уже есть, удаляем их if mobileButtonContainer then mobileButtonContainer:Destroy() mobileButtonContainer = nil mobileButtonsVisible = false return end print("[Mobile] Creating mobile buttons...") -- Контейнер для кнопок mobileButtonContainer = Instance.new("Frame") mobileButtonContainer.Size = UDim2.new(1, 0, 1, 0) -- на весь экран mobileButtonContainer.Position = UDim2.new(0, 0, 0, 0) mobileButtonContainer.BackgroundTransparency = 1 mobileButtonContainer.ZIndex = 20 mobileButtonContainer.Parent = parentGui -- Размеры экрана (используем AbsoluteSize, если ViewportSize глючит) local screenSize = parentGui.AbsoluteSize if screenSize.X == 0 or screenSize.Y == 0 then screenSize = Vector2.new(800, 600) -- запасной вариант end local btnSize = 70 local spacing = 15 local bottomOffset = 80 -- Кнопка Wheelie (синяя, слева) local wheelieBtn = Instance.new("TextButton") wheelieBtn.Size = UDim2.new(0, btnSize, 0, btnSize) wheelieBtn.Position = UDim2.new(0, 20, 1, -(btnSize + bottomOffset)) wheelieBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 255) wheelieBtn.Text = "W" wheelieBtn.TextColor3 = Color3.fromRGB(255, 255, 255) wheelieBtn.Font = Enum.Font.SourceSansBold wheelieBtn.TextSize = 20 wheelieBtn.BorderSizePixel = 0 wheelieBtn.ZIndex = 25 wheelieBtn.Parent = mobileButtonContainer local wCorner = Instance.new("UICorner") wCorner.CornerRadius = UDim.new(0, 15) wCorner.Parent = wheelieBtn -- Кнопка Stoppie (красная, вторая) local stoppieBtn = Instance.new("TextButton") stoppieBtn.Size = UDim2.new(0, btnSize, 0, btnSize) stoppieBtn.Position = UDim2.new(0, 20 + btnSize + spacing, 1, -(btnSize + bottomOffset)) stoppieBtn.BackgroundColor3 = Color3.fromRGB(255, 100, 50) stoppieBtn.Text = "H" stoppieBtn.TextColor3 = Color3.fromRGB(255, 255, 255) stoppieBtn.Font = Enum.Font.SourceSansBold stoppieBtn.TextSize = 20 stoppieBtn.BorderSizePixel = 0 stoppieBtn.ZIndex = 25 stoppieBtn.Parent = mobileButtonContainer local sCorner = Instance.new("UICorner") sCorner.CornerRadius = UDim.new(0, 15) sCorner.Parent = stoppieBtn -- Кнопка Jump (зелёная, справа) local jumpBtn = Instance.new("TextButton") jumpBtn.Size = UDim2.new(0, 80, 0, 80) jumpBtn.Position = UDim2.new(1, -(80 + 20), 1, -(80 + bottomOffset)) jumpBtn.BackgroundColor3 = Color3.fromRGB(50, 200, 50) jumpBtn.Text = "⬆" jumpBtn.TextColor3 = Color3.fromRGB(255, 255, 255) jumpBtn.Font = Enum.Font.SourceSansBold jumpBtn.TextSize = 30 jumpBtn.BorderSizePixel = 0 jumpBtn.ZIndex = 25 jumpBtn.Parent = mobileButtonContainer local jCorner = Instance.new("UICorner") jCorner.CornerRadius = UDim.new(0, 20) jCorner.Parent = jumpBtn -- Обработчики wheelieBtn.MouseButton1Click:Connect(toggleWheelie) stoppieBtn.MouseButton1Click:Connect(toggleStoppie) jumpBtn.MouseButton1Click:Connect(doJump) -- Долгое нажатие (для телефона) local function setupLongPress(btn, action) local holdTime = 0 local isHolding = false local conn = nil btn.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch then isHolding = true holdTime = 0 if conn then conn:Disconnect() end conn = RunService.Heartbeat:Connect(function(dt) if isHolding then holdTime = holdTime + dt if holdTime > 0.5 then action() holdTime = 0 end end end) end end) btn.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch then isHolding = false if conn then conn:Disconnect() conn = nil end end end) end setupLongPress(wheelieBtn, toggleWheelie) setupLongPress(stoppieBtn, toggleStoppie) -- Подпись снизу local label = Instance.new("TextLabel") label.Size = UDim2.new(0, 250, 0, 25) label.Position = UDim2.new(0, 20, 1, -25) label.BackgroundTransparency = 1 label.Text = "Tap: stunt | Hold: toggle off" label.TextColor3 = Color3.fromRGB(200, 200, 200) label.Font = Enum.Font.SourceSans label.TextSize = 12 label.TextXAlignment = Enum.TextXAlignment.Left label.ZIndex = 25 label.Parent = mobileButtonContainer print("[Mobile] Buttons created successfully!") mobileButtonsVisible = true end --==========================================================================================-- -- GUI MENU WITH BIND EDITOR + MOBILE TOGGLE BUTTON --==========================================================================================-- function createStuntMenu() local oldGui = CoreGui:FindFirstChild("MankiStuntMenu") if oldGui then oldGui:Destroy() end local screenGui = Instance.new("ScreenGui") screenGui.Name = "MankiStuntMenu" screenGui.ResetOnSpawn = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling -- Сначала пытаемся в CoreGui, если не получается — в PlayerGui local parentSuccess, _ = pcall(function() screenGui.Parent = CoreGui end) if not parentSuccess then screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") end print("[GUI] ScreenGui parent:", screenGui.Parent and screenGui.Parent.Name or "nil") -- Основная панель local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 280, 0, 380) mainFrame.Position = UDim2.new(0.05, 0, 0.35, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25) mainFrame.BorderSizePixel = 0 mainFrame.Active = true mainFrame.Draggable = true mainFrame.Parent = screenGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = mainFrame local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 30) title.BackgroundColor3 = Color3.fromRGB(35, 35, 35) title.Text = "MANKI 2K - SETTINGS" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.SourceSansBold title.TextSize = 16 title.Parent = mainFrame local titleCorner = Instance.new("UICorner") titleCorner.CornerRadius = UDim.new(0, 8) titleCorner.Parent = title -- SLIDER CREATOR local function createSlider(yPosition, labelText, defaultValue, callback) local textLabel = Instance.new("TextLabel") textLabel.Size = UDim2.new(1, -20, 0, 20) textLabel.Position = UDim2.new(0, 10, 0, yPosition) textLabel.BackgroundTransparency = 1 textLabel.Text = labelText .. ": " .. defaultValue textLabel.TextColor3 = Color3.fromRGB(200, 200, 200) textLabel.Font = Enum.Font.SourceSans textLabel.TextSize = 14 textLabel.TextXAlignment = Enum.TextXAlignment.Left textLabel.Parent = mainFrame local sliderTrack = Instance.new("Frame") sliderTrack.Size = UDim2.new(1, -20, 0, 6) sliderTrack.Position = UDim2.new(0, 10, 0, yPosition + 22) sliderTrack.BackgroundColor3 = Color3.fromRGB(50, 50, 50) sliderTrack.BorderSizePixel = 0 sliderTrack.Parent = mainFrame local sliderFill = Instance.new("Frame") sliderFill.Size = UDim2.new(defaultValue / 100, 0, 1, 0) sliderFill.BackgroundColor3 = Color3.fromRGB(0, 120, 255) sliderFill.BorderSizePixel = 0 sliderFill.Parent = sliderTrack local sliderButton = Instance.new("ImageButton") sliderButton.Size = UDim2.new(0, 14, 0, 14) sliderButton.Position = UDim2.new(defaultValue / 100, -7, 0.5, -7) sliderButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) sliderButton.BorderSizePixel = 0 sliderButton.Parent = sliderTrack local buttonCorner = Instance.new("UICorner") buttonCorner.CornerRadius = UDim.new(1, 0) buttonCorner.Parent = sliderButton local dragging = false local function updateSlider(input) local originalX = sliderTrack.AbsolutePosition.X local width = sliderTrack.AbsoluteSize.X local mouseX = input.Position.X local percentage = math.clamp((mouseX - originalX) / width, 0, 1) local value = math.round(percentage * 100) sliderButton.Position = UDim2.new(percentage, -7, 0.5, -7) sliderFill.Size = UDim2.new(percentage, 0, 1, 0) textLabel.Text = labelText .. ": " .. value callback(value) end sliderButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end end) UserInputService.InputChanged:Connect(function(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then updateSlider(input) end end) end -- BIND BUTTON CREATOR local function createBindButton(yPosition, labelText, bindKey, bindName) local frame = Instance.new("Frame") frame.Size = UDim2.new(1, -20, 0, 28) frame.Position = UDim2.new(0, 10, 0, yPosition) frame.BackgroundTransparency = 1 frame.Parent = mainFrame local label = Instance.new("TextLabel") label.Size = UDim2.new(0.5, 0, 1, 0) label.Position = UDim2.new(0, 0, 0, 0) label.BackgroundTransparency = 1 label.Text = labelText label.TextColor3 = Color3.fromRGB(200, 200, 200) label.Font = Enum.Font.SourceSans label.TextSize = 14 label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = frame local button = Instance.new("TextButton") button.Size = UDim2.new(0, 80, 1, -4) button.Position = UDim2.new(0.6, 0, 0, 2) button.BackgroundColor3 = Color3.fromRGB(60, 60, 60) button.Text = tostring(bindKey):gsub("Enum.KeyCode.", "") button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Font = Enum.Font.SourceSansBold button.TextSize = 13 button.BorderSizePixel = 0 button.Parent = frame local btnCorner = Instance.new("UICorner") btnCorner.CornerRadius = UDim.new(0, 4) btnCorner.Parent = button button.MouseButton1Click:Connect(function() if waitingForBind then print("[Stunt System]: Already waiting for bind: " .. waitingForBind) return end waitingForBind = bindName button.Text = "PRESS KEY" button.BackgroundColor3 = Color3.fromRGB(200, 50, 50) print("[Stunt System]: Waiting for key press for " .. bindName) end) end -- Sliders createSlider(45, "WHEELIE ANGLE", ANGLE_WHEELIE, function(v) ANGLE_WHEELIE = v end) createSlider(110, "STOPPIE ANGLE", ANGLE_STOPPIE, function(v) ANGLE_STOPPIE = v end) -- Bind buttons createBindButton(175, "Wheelie Key", BINDS.WHEELIE, "WHEELIE") createBindButton(208, "Stoppie Key", BINDS.STOPPIE, "STOPPIE") createBindButton(241, "Jump Key", BINDS.JUMP, "JUMP") -- Кнопка включения мобильных кнопок local mobileToggleBtn = Instance.new("TextButton") mobileToggleBtn.Size = UDim2.new(1, -20, 0, 30) mobileToggleBtn.Position = UDim2.new(0, 10, 0, 278) mobileToggleBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 70) mobileToggleBtn.Text = "SHOW MOBILE BUTTONS" mobileToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255) mobileToggleBtn.Font = Enum.Font.SourceSansBold mobileToggleBtn.TextSize = 14 mobileToggleBtn.BorderSizePixel = 0 mobileToggleBtn.Parent = mainFrame local toggleCorner = Instance.new("UICorner") toggleCorner.CornerRadius = UDim.new(0, 6) toggleCorner.Parent = mobileToggleBtn mobileToggleBtn.MouseButton1Click:Connect(function() if mobileButtonsVisible then if mobileButtonContainer then mobileButtonContainer:Destroy() mobileButtonContainer = nil end mobileButtonsVisible = false mobileToggleBtn.Text = "SHOW MOBILE BUTTONS" mobileToggleBtn.BackgroundColor3 = Color3.fromRGB(60, 60, 70) print("[Mobile] Buttons hidden.") else createMobileButtons(screenGui) mobileToggleBtn.Text = "HIDE MOBILE BUTTONS" mobileToggleBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 0) end end) -- Info text local infoLabel = Instance.new("TextLabel") infoLabel.Size = UDim2.new(1, -20, 0, 20) infoLabel.Position = UDim2.new(0, 10, 0, 316) infoLabel.BackgroundTransparency = 1 infoLabel.Text = "Click bind button then press new key" infoLabel.TextColor3 = Color3.fromRGB(150, 150, 150) infoLabel.Font = Enum.Font.SourceSans infoLabel.TextSize = 11 infoLabel.TextXAlignment = Enum.TextXAlignment.Left infoLabel.Parent = mainFrame -- Если при пересоздании кнопки были видны, восстанавливаем if mobileButtonsVisible then createMobileButtons(screenGui) mobileToggleBtn.Text = "HIDE MOBILE BUTTONS" mobileToggleBtn.BackgroundColor3 = Color3.fromRGB(0, 150, 0) end return screenGui end -- Init createStuntMenu() print("[Manki 2K]: Loaded! Click 'SHOW MOBILE BUTTONS' in menu to enable touch controls.")