--[[ Mahoraga Hub (feito para Xeno) - GUI arrastável e fechável - Spawn: invoca UM Mahoraga (Jujutsu Kaisen) por vez, montado com Parts (roda de Dharma girando sobre a cabeça e a Espada da Extermínio no braço direito) - Ataque ON : ele te persegue e, se você chegar perto, te mata com a lâmina - Ataque OFF: ele só vagueia, sem te machucar - Ativo OFF : desativa ele por completo (congela, sem andar e sem atacar) - Em cima da cabeça você fica seguro e é levado por ele enquanto ele anda - Tudo roda só no seu cliente (só você vê o Mahoraga) ]] local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local Workspace = game:GetService("Workspace") local LocalPlayer = Players.LocalPlayer -------------------------------------------------------------------- -- Configurações -------------------------------------------------------------------- local SPEED_WANDER = 9 -- velocidade passeando local SPEED_CHASE = 20 -- velocidade perseguindo local AGGRO_RANGE = 150 -- distância máxima para ele te notar local ATTACK_START = 17 -- distância para começar a atacar local REACH = 15 -- alcance da lâmina no momento do golpe local GRACE_SECONDS = 4 -- tempo sem atacar logo após o spawn local SWING_COOLDOWN = 1.6 -------------------------------------------------------------------- -- Onde colocar a GUI -------------------------------------------------------------------- local okParent, guiParent = pcall(function() if gethui then return gethui() end return game:GetService("CoreGui") end) if not okParent or not guiParent then guiParent = LocalPlayer:WaitForChild("PlayerGui") end local old = guiParent:FindFirstChild("MahoragaHub") if old then old:Destroy() end -------------------------------------------------------------------- -- Estado -------------------------------------------------------------------- local mah = nil -- Mahoraga atual (só pode existir um) local isActive = true -- desativar/ativar local isAggressive = true -- pode te atacar ou não local connections = {} local BG = Color3.fromRGB(24, 22, 32) local BAR = Color3.fromRGB(150, 105, 35) local BTN = Color3.fromRGB(60, 52, 80) local ACCENT = Color3.fromRGB(215, 170, 70) local GREEN = Color3.fromRGB(150, 255, 180) local RED = Color3.fromRGB(255, 130, 150) local NEUTRAL = Color3.fromRGB(220, 210, 190) -------------------------------------------------------------------- -- GUI -------------------------------------------------------------------- local gui = Instance.new("ScreenGui") gui.Name = "MahoragaHub" gui.ResetOnSpawn = false gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.Parent = guiParent local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 280, 0, 372) frame.Position = UDim2.new(0.5, -140, 0.5, -186) frame.BackgroundColor3 = BG frame.BorderSizePixel = 0 frame.Parent = gui Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 12) local stroke = Instance.new("UIStroke", frame) stroke.Color = ACCENT stroke.Thickness = 2 local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 38) titleBar.BackgroundColor3 = BAR titleBar.BorderSizePixel = 0 titleBar.Parent = frame Instance.new("UICorner", titleBar).CornerRadius = UDim.new(0, 12) local titleFix = Instance.new("Frame") titleFix.Size = UDim2.new(1, 0, 0, 12) titleFix.Position = UDim2.new(0, 0, 1, -12) titleFix.BackgroundColor3 = BAR titleFix.BorderSizePixel = 0 titleFix.Parent = titleBar local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, -50, 1, 0) titleLabel.Position = UDim2.new(0, 12, 0, 0) titleLabel.BackgroundTransparency = 1 titleLabel.Text = "☸ mahoraga hub" titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 16 titleLabel.TextColor3 = Color3.new(1, 1, 1) titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.Parent = titleBar local closeBtn = Instance.new("TextButton") closeBtn.Size = UDim2.new(0, 28, 0, 28) closeBtn.Position = UDim2.new(1, -34, 0, 5) closeBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 90) closeBtn.Text = "X" closeBtn.Font = Enum.Font.GothamBold closeBtn.TextSize = 14 closeBtn.TextColor3 = Color3.new(1, 1, 1) closeBtn.Parent = titleBar Instance.new("UICorner", closeBtn).CornerRadius = UDim.new(0, 8) local function makeButton(text, y, color) local b = Instance.new("TextButton") b.Size = UDim2.new(1, -24, 0, 34) b.Position = UDim2.new(0, 12, 0, y) b.BackgroundColor3 = color or BTN b.Text = text b.Font = Enum.Font.GothamBold b.TextSize = 13 b.TextColor3 = Color3.new(1, 1, 1) b.Parent = frame Instance.new("UICorner", b).CornerRadius = UDim.new(0, 8) return b end local spawnBtn = makeButton("⚔ Spawn", 50, Color3.fromRGB(150, 105, 35)) local activeBtn = makeButton("⚡ Ativo: ON", 92, Color3.fromRGB(70, 150, 110)) local attackBtn = makeButton("🗡 Ataque: ON", 134, Color3.fromRGB(170, 70, 80)) local climbBtn = makeButton("⬆ Subir na cabeça", 176) local descBtn = makeButton("⬇ Descer", 218) local removeBtn = makeButton("🗑 Remover", 260, Color3.fromRGB(110, 60, 60)) local status = Instance.new("TextLabel") status.Size = UDim2.new(1, -24, 0, 66) status.Position = UDim2.new(0, 12, 0, 302) status.BackgroundTransparency = 1 status.Text = "Clique em Spawn para invocar o Mahoraga." status.Font = Enum.Font.Gotham status.TextSize = 12 status.TextWrapped = true status.TextYAlignment = Enum.TextYAlignment.Top status.TextColor3 = NEUTRAL status.Parent = frame local function setStatus(text, color) status.Text = text status.TextColor3 = color or NEUTRAL end -- Arrastar do local dragging, dragStart, startPos titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) table.insert(connections, UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart frame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end)) end -------------------------------------------------------------------- -- Helpers -------------------------------------------------------------------- local function flat(v) return Vector3.new(v.X, 0, v.Z) end local function getPlayerParts() local char = LocalPlayer.Character local hrp = char and char:FindFirstChild("HumanoidRootPart") local hum = char and char:FindFirstChildOfClass("Humanoid") return char, hrp, hum end local function ignoreList() local list = {} for _, p in ipairs(Players:GetPlayers()) do if p.Character then table.insert(list, p.Character) end end if mah then table.insert(list, mah.model) end return list end local function groundY(pos) local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = ignoreList() local r = Workspace:Raycast(pos + Vector3.new(0, 40, 0), Vector3.new(0, -250, 0), params) return r and r.Position.Y end -------------------------------------------------------------------- -- Construção do Mahoraga -------------------------------------------------------------------- local function newPart(parent, name, size, color, material, collide) local p = Instance.new("Part") p.Name = name p.Size = size p.Color = color p.Material = material or Enum.Material.SmoothPlastic p.Anchored = false p.CanCollide = (collide ~= false) p.Massless = true p.TopSurface = Enum.SurfaceType.Smooth p.BottomSurface = Enum.SurfaceType.Smooth p.Parent = parent return p end local function joint(name, part0, part1, c0, c1) local m = Instance.new("Motor6D") m.Name = name m.Part0 = part0 m.Part1 = part1 m.C0 = c0 or CFrame.new() m.C1 = c1 or CFrame.new() m.Parent = part0 return m end local function buildMahoraga(spawnCF) local model = Instance.new("Model") model.Name = "Mahoraga" local SKIN = Color3.fromRGB(224, 220, 210) local SKIN_LIGHT = Color3.fromRGB(240, 237, 228) local SKIN_SHADE = Color3.fromRGB(184, 180, 172) local DARK = Color3.fromRGB(26, 24, 32) local CLOTH = Color3.fromRGB(52, 38, 70) local GOLD = Color3.fromRGB(236, 198, 98) local STEEL = Color3.fromRGB(208, 213, 224) local STEEL_DARK = Color3.fromRGB(120, 126, 142) local ROPE = Color3.fromRGB(214, 198, 150) local MARBLE = Enum.Material.Marble local FABRIC = Enum.Material.Fabric local METAL = Enum.Material.Metal local NEON = Enum.Material.Neon local V3, CF, ANG = Vector3.new, CFrame.new, CFrame.Angles -- Pelvis (raiz, ancorada) local root = newPart(model, "Pelvis", V3(4.6, 2, 2.8), DARK, FABRIC) root.Anchored = true model.PrimaryPart = root -- Peças principais (as invisíveis servem só de colisão/junta) local torso = newPart(model, "Torso", V3(6.4, 6.5, 3.2), SKIN, MARBLE) local head = newPart(model, "Head", V3(4, 3.6, 4), SKIN, MARBLE) local legL = newPart(model, "LegL", V3(2.6, 7, 2.6), SKIN) local legR = newPart(model, "LegR", V3(2.6, 7, 2.6), SKIN) local armLU = newPart(model, "ArmLU", V3(2.2, 4.6, 2.2), SKIN) local armLL = newPart(model, "ArmLL", V3(1.9, 4.2, 1.9), SKIN) local armRU = newPart(model, "ArmRU", V3(2.2, 4.6, 2.2), SKIN) local armRL = newPart(model, "ArmRL", V3(2, 3.2, 2), DARK) local blade = newPart(model, "Blade", V3(0.8, 6.3, 2.6), STEEL, METAL) for _, p in ipairs({ legL, legR, armLU, armLL, armRU, armRL }) do p.Transparency = 1 end local J, base = {}, {} local function reg(key, j) J[key] = j base[key] = j.C0 end reg("torso", joint("Torso", root, torso, CF(0, 4.25, 0))) reg("head", joint("Head", torso, head, CF(0, 5.05, 0))) reg("hipL", joint("HipL", root, legL, CF(-1.7, -1, 0), CF(0, 3.5, 0))) reg("hipR", joint("HipR", root, legR, CF(1.7, -1, 0), CF(0, 3.5, 0))) reg("shoL", joint("ShoulderL", torso, armLU, CF(-4.3, 2.6, 0), CF(0, 2.3, 0))) reg("shoR", joint("ShoulderR", torso, armRU, CF(4.3, 2.6, 0), CF(0, 2.3, 0))) reg("elbL", joint("ElbowL", armLU, armLL, CF(0, -2.3, 0), CF(0, 2.1, 0))) reg("elbR", joint("ElbowR", armRU, armRL, CF(0, -2.3, 0), CF(0, 1.6, 0))) reg("blade", joint("Blade", armRL, blade, CF(0, -1.6, 0), CF(0, 3.15, 0))) -- Helpers de detalhes (sem colisão) local function decor(name, parent, size, color, cf, material, shape) local p = newPart(model, name, size, color, material, false) p.CanQuery = false if shape then p.Shape = shape end joint(name, parent, p, cf) return p end local function ball(name, parent, d, color, cf, material) return decor(name, parent, V3(d, d, d), color, cf, material, Enum.PartType.Ball) end -- cilindro com o comprimento no eixo Y do pai local function cyl(name, parent, length, diameter, color, cf, material) local p = newPart(model, name, V3(length, diameter, diameter), color, material, false) p.CanQuery = false p.Shape = Enum.PartType.Cylinder joint(name, parent, p, cf * ANG(0, 0, math.pi / 2)) return p end ---------------------------------------------------------------- -- Pelvis / tanga ---------------------------------------------------------------- decor("Belt", root, V3(4.9, 0.7, 3.1), GOLD, CF(0, 0.6, 0), METAL) decor("LoinFront", root, V3(3.4, 5.2, 0.35), CLOTH, CF(0, -3.2, -1.55), FABRIC) decor("LoinBack", root, V3(3.4, 5.2, 0.35), CLOTH, CF(0, -3.2, 1.55), FABRIC) decor("LoinTrimF", root, V3(3.5, 0.3, 0.45), GOLD, CF(0, -5.7, -1.55), METAL) decor("LoinTrimB", root, V3(3.5, 0.3, 0.45), GOLD, CF(0, -5.7, 1.55), METAL) ---------------------------------------------------------------- -- Torso: peitoral, abdômen, corda, capa e ombros ---------------------------------------------------------------- decor("PecL", torso, V3(2.9, 2.1, 0.8), SKIN_LIGHT, CF(-1.6, 1.9, -1.7), MARBLE) decor("PecR", torso, V3(2.9, 2.1, 0.8), SKIN_LIGHT, CF(1.6, 1.9, -1.7), MARBLE) for r = 0, 2 do for _, s in ipairs({ -1, 1 }) do decor("Abs", torso, V3(1.5, 0.95, 0.6), SKIN_LIGHT, CF(s * 0.85, 0.45 - r * 1.1, -1.65), MARBLE) end end decor("Sash", torso, V3(0.8, 8.2, 0.7), ROPE, CF(0, 0.3, -1.85) * ANG(0, 0, 0.65), FABRIC) decor("Cape", torso, V3(5.2, 9.6, 0.3), CLOTH, CF(0, -2.4, 1.85), FABRIC) decor("CapeTrim", torso, V3(5.3, 0.35, 0.4), GOLD, CF(0, -7.2, 1.85), METAL) cyl("Collar", torso, 0.5, 3.4, GOLD, CF(0, 3.3, 0), METAL) for _, s in ipairs({ -1, 1 }) do ball("ShoulderBall", torso, 3.9, SKIN, CF(s * 4.3, 2.7, 0), MARBLE) decor("Pauldron", torso, V3(4.0, 0.9, 4.2), DARK, CF(s * 4.3, 4.1, 0), FABRIC) decor("PauldronRim", torso, V3(4.2, 0.25, 4.4), GOLD, CF(s * 4.3, 4.6, 0), METAL) end ---------------------------------------------------------------- -- Cabeça: expressão severa, olhos pálidos e protetor de mandíbula ---------------------------------------------------------------- decor("Crown", head, V3(4.3, 0.5, 4.3), DARK, CF(0, 1.4, 0), FABRIC) decor("CrownTrim", head, V3(4.35, 0.14, 4.35), GOLD, CF(0, 1.05, 0), METAL) decor("Brow", head, V3(4.2, 0.6, 0.8), SKIN_SHADE, CF(0, 0.55, -1.85), MARBLE) for _, s in ipairs({ -1, 1 }) do decor("EyeSocket", head, V3(1.0, 0.5, 0.15), DARK, CF(s * 0.95, 0, -2.02)) decor("Eye", head, V3(0.55, 0.18, 0.08), Color3.fromRGB(255, 235, 170), CF(s * 0.95, 0, -2.1), NEON) decor("Ear", head, V3(0.5, 1.4, 1.0), SKIN_SHADE, CF(s * 2.2, 0, 0), MARBLE) end decor("Nose", head, V3(0.7, 1.5, 0.9), SKIN_SHADE, CF(0, -0.5, -2.15) * ANG(-0.25, 0, 0), MARBLE) decor("Jaw", head, V3(3.6, 1.3, 0.5), DARK, CF(0, -1.2, -2.05), FABRIC) for i = -2, 2 do decor("JawLine", head, V3(0.12, 1.1, 0.1), SKIN, CF(i * 0.6, -1.2, -2.33)) end ---------------------------------------------------------------- -- Pernas ---------------------------------------------------------------- for _, leg in ipairs({ legL, legR }) do cyl("Thigh", leg, 3.8, 3.1, SKIN, CF(0, 1.5, 0), MARBLE) ball("Knee", leg, 2.5, SKIN_LIGHT, CF(0, -0.4, -0.1), MARBLE) cyl("Shin", leg, 3.4, 2.5, SKIN, CF(0, -1.9, 0), MARBLE) cyl("ShinWrap", leg, 0.9, 2.85, DARK, CF(0, -2.8, 0), FABRIC) cyl("ShinWrap", leg, 0.5, 2.8, CLOTH, CF(0, -1.6, 0), FABRIC) decor("Foot", leg, V3(2.9, 1, 4.0), DARK, CF(0, -3.0, -0.6), FABRIC) decor("ToeCap", leg, V3(2.9, 0.6, 0.8), GOLD, CF(0, -2.9, -2.4), METAL) end ---------------------------------------------------------------- -- Braço esquerdo ---------------------------------------------------------------- cyl("BicepL", armLU, 4.2, 2.8, SKIN, CF(0, 0, 0), MARBLE) cyl("ArmbandL", armLU, 0.5, 3.05, GOLD, CF(0, -0.9, 0), METAL) cyl("ForearmL", armLL, 3.8, 2.3, SKIN, CF(0, 0, 0), MARBLE) cyl("WristWrapL", armLL, 1.4, 2.55, DARK, CF(0, -0.8, 0), FABRIC) ball("HandL", armLL, 2.4, SKIN, CF(0, -2.7, 0), MARBLE) for i = 1, 4 do decor("FingerL", armLL, V3(0.4, 1.1, 0.45), SKIN_SHADE, CF(-0.75 + (i - 1) * 0.5, -3.6, -0.2), MARBLE) end ---------------------------------------------------------------- -- Braço direito + Espada da Extermínio ---------------------------------------------------------------- cyl("BicepR", armRU, 4.2, 3.0, SKIN, CF(0, 0, 0), MARBLE) cyl("ArmbandR", armRU, 0.5, 3.25, GOLD, CF(0, -0.9, 0), METAL) cyl("BracerR", armRL, 3.2, 2.7, DARK, CF(0, 0, 0), FABRIC) cyl("BracerRingA", armRL, 0.4, 2.95, GOLD, CF(0, 0.9, 0), METAL) cyl("BracerRingB", armRL, 0.4, 2.95, GOLD, CF(0, -1.0, 0), METAL) cyl("Hilt", armRL, 1.2, 1.5, ROPE, CF(0, -1.9, 0), FABRIC) decor("Guard", armRL, V3(1.3, 0.5, 4.0), GOLD, CF(0, -2.5, 0), METAL) decor("BladeRidge", blade, V3(0.95, 5.4, 0.5), STEEL_DARK, CF(0, 0.2, 0.55), METAL) decor("BladeEdge", blade, V3(0.35, 5.6, 0.12), Color3.fromRGB(255, 250, 230), CF(0, -0.2, -1.28), NEON) decor("BladeTip", blade, V3(0.8, 1.84, 1.84), STEEL, CF(0, -3.15, 0) * ANG(math.pi / 4, 0, 0), METAL) for i = 1, 4 do decor("BladeTooth", blade, V3(0.6, 0.9, 0.9), STEEL, CF(0, 1.9 - (i - 1) * 1.1, -1.3) * ANG(math.pi / 4, 0, 0), METAL) end ---------------------------------------------------------------- -- Roda de Dharma sobre a cabeça (gira) + brilho dourado ---------------------------------------------------------------- local wheelCore = newPart(model, "WheelCore", V3(0.4, 0.4, 0.4), GOLD, NEON, false) wheelCore.Transparency = 1 wheelCore.CanQuery = false reg("wheel", joint("Wheel", head, wheelCore, CF(0, 3.4, 0))) local glow = Instance.new("PointLight") glow.Color = GOLD glow.Brightness = 2 glow.Range = 20 glow.Parent = wheelCore local R, R2, N = 3.9, 3.0, 24 for i = 1, N do local a = (i / N) * math.pi * 2 decor("WheelRing", wheelCore, V3(1.2, 0.5, 0.6), GOLD, CF(R * math.cos(a), 0, R * math.sin(a)) * ANG(0, -(a + math.pi / 2), 0), NEON) decor("WheelInner", wheelCore, V3(1.0, 0.3, 0.3), GOLD, CF(R2 * math.cos(a), 0, R2 * math.sin(a)) * ANG(0, -(a + math.pi / 2), 0), NEON) end for i = 1, 8 do local a = (i / 8) * math.pi * 2 decor("WheelHandle", wheelCore, V3(2.6, 0.4, 0.4), GOLD, CF((R + 1.1) * math.cos(a), 0, (R + 1.1) * math.sin(a)) * ANG(0, -a, 0), NEON) ball("WheelPommel", wheelCore, 0.9, GOLD, CF((R + 2.4) * math.cos(a), 0, (R + 2.4) * math.sin(a)), NEON) end model:PivotTo(spawnCF) return { model = model, root = root, head = head, blade = blade, J = J, base = base, facing = spawnCF.LookVector * Vector3.new(1, 0, 1), phase = 0, amp = 0, wheelAngle = 0, swing = nil, lastSwing = 0, wanderTarget = nil, wanderWait = 1, graceUntil = os.clock() + GRACE_SECONDS, } end -------------------------------------------------------------------- -- Detecção de "em cima da cabeça" -------------------------------------------------------------------- local function isRiding(char, hrp) if not mah or not char or not hrp then return false end local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = { char } local r = Workspace:Raycast(hrp.Position, Vector3.new(0, -7, 0), params) return r ~= nil and r.Instance:IsDescendantOf(mah.model) and r.Position.Y > mah.root.Position.Y + 7 end -------------------------------------------------------------------- -- Golpe -------------------------------------------------------------------- local REST_ARM = 0.35 local function swingAngle(t) if t < 0.45 then return REST_ARM + (-2.4 - REST_ARM) * (t / 0.45) elseif t < 0.65 then return -2.4 + (1.3 + 2.4) * ((t - 0.45) / 0.2) else local a = math.min((t - 0.65) / 0.35, 1) return 1.3 + (REST_ARM - 1.3) * a end end -------------------------------------------------------------------- -- Loop principal -------------------------------------------------------------------- local function step(dt) local m = mah if not m or not m.model.Parent then return end local root = m.root local char, hrp, hum = getPlayerParts() local alive = hrp ~= nil and hum ~= nil and hum.Health > 0 local riding = alive and isRiding(char, hrp) or false local oldCF = root.CFrame local pos = oldCF.Position local newPos = pos local desiredDir = nil local speed = 0 local now = os.clock() if isActive then local playerDist = alive and flat(hrp.Position - pos).Magnitude or nil if m.swing then -- atacando: fica parado olhando para você if alive then desiredDir = flat(hrp.Position - pos) end m.swing.t += dt if m.swing.t >= 0.55 and not m.swing.checked then m.swing.checked = true if isAggressive and alive and not riding then local d = flat(hrp.Position - root.Position).Magnitude local dy = math.abs(hrp.Position.Y - root.Position.Y) if d < REACH and dy < 16 then hum.Health = 0 end end end if m.swing.t >= 1 then m.swing = nil m.lastSwing = now end elseif isAggressive and playerDist and playerDist < AGGRO_RANGE and not riding then -- perseguir desiredDir = flat(hrp.Position - pos) if playerDist > 10 then speed = SPEED_CHASE end if playerDist < ATTACK_START and now > m.graceUntil and now - m.lastSwing > SWING_COOLDOWN then m.swing = { t = 0, checked = false } end else -- passear if m.wanderTarget then local toT = flat(m.wanderTarget - pos) if toT.Magnitude < 3 then m.wanderTarget = nil m.wanderWait = 1 + math.random() * 2.5 else desiredDir = toT speed = SPEED_WANDER end else m.wanderWait -= dt if m.wanderWait <= 0 then local ang = math.random() * math.pi * 2 local dist = 25 + math.random() * 30 m.wanderTarget = pos + Vector3.new(math.cos(ang) * dist, 0, math.sin(ang) * dist) end end end else m.swing = nil end -- Direção / movimento if desiredDir and desiredDir.Magnitude > 0.01 then local d = desiredDir.Unit local f = m.facing + (d - m.facing) * math.min(1, dt * 5) if f.Magnitude > 0.01 then m.facing = f.Unit end end if speed > 0 then newPos = pos + m.facing * speed * dt end -- Altura (segue o chão) local gy = groundY(newPos) local targetY = gy and (gy + 8) or pos.Y local newY = pos.Y + (targetY - pos.Y) * math.min(1, dt * 8) local finalPos = Vector3.new(newPos.X, newY, newPos.Z) local newCF = CFrame.lookAt(finalPos, finalPos + m.facing) root.CFrame = newCF -- Carrega quem está em cima da cabeça if riding then hrp.CFrame = (newCF * oldCF:Inverse()) * hrp.CFrame end -- Animação local moving = speed > 0 if moving then m.phase += dt * speed * 0.35 end m.amp += ((moving and 0.6 or 0) - m.amp) * math.min(1, dt * 8) if isActive then m.wheelAngle += dt * (m.swing and 8 or 1.5) end local J, B = m.J, m.base local s = math.sin(m.phase) J.hipL.C0 = B.hipL * CFrame.Angles(s * m.amp, 0, 0) J.hipR.C0 = B.hipR * CFrame.Angles(-s * m.amp, 0, 0) J.shoL.C0 = B.shoL * CFrame.Angles(-s * m.amp * 0.6 + 0.1, 0, 0) local armR = m.swing and swingAngle(m.swing.t) or (REST_ARM + s * m.amp * 0.4) J.shoR.C0 = B.shoR * CFrame.Angles(armR, 0, 0) J.elbR.C0 = B.elbR * CFrame.Angles(0.15, 0, 0) J.torso.C0 = B.torso * CFrame.new(0, math.sin(now * 2) * 0.12 + math.abs(s) * m.amp * 0.25, 0) J.wheel.C0 = B.wheel * CFrame.Angles(0, m.wheelAngle, 0) end table.insert(connections, RunService.Heartbeat:Connect(step)) -------------------------------------------------------------------- -- Ações dos botões -------------------------------------------------------------------- local function doSpawn() if mah then setStatus("Já existe um Mahoraga. Remova ele antes de invocar outro.", RED) return end local _, hrp = getPlayerParts() if not hrp then setStatus("Seu personagem ainda não carregou.", RED) return end local pos = hrp.Position + hrp.CFrame.LookVector * 35 local gy = groundY(pos) local y = (gy or (hrp.Position.Y - 3)) + 8 local spawnPos = Vector3.new(pos.X, y, pos.Z) local lookAt = Vector3.new(hrp.Position.X, y, hrp.Position.Z) mah = buildMahoraga(CFrame.lookAt(spawnPos, lookAt)) mah.model.Parent = Workspace setStatus("Mahoraga invocado! Você tem alguns segundos antes dele atacar.", GREEN) end local function doRemove() if not mah then setStatus("Não existe Mahoraga para remover.", RED) return end mah.model:Destroy() mah = nil setStatus("Mahoraga removido.", NEUTRAL) end local function doClimb() if not mah then setStatus("Invoque o Mahoraga primeiro.", RED) return end local _, hrp = getPlayerParts() if not hrp then return end hrp.AssemblyLinearVelocity = Vector3.zero hrp.CFrame = mah.head.CFrame * CFrame.new(0, 1.8 + 3.5, 0) setStatus("Você está na cabeça dele. Ande por ela e vá junto com ele!", GREEN) end local function doDescend() if not mah then setStatus("Invoque o Mahoraga primeiro.", RED) return end local _, hrp = getPlayerParts() if not hrp then return end local side = (mah.root.CFrame * CFrame.new(12, 0, 0)).Position local gy = groundY(side) hrp.AssemblyLinearVelocity = Vector3.zero hrp.CFrame = CFrame.new(side.X, (gy or side.Y - 8) + 4, side.Z) setStatus("Você desceu.", NEUTRAL) end spawnBtn.MouseButton1Click:Connect(doSpawn) removeBtn.MouseButton1Click:Connect(doRemove) climbBtn.MouseButton1Click:Connect(doClimb) descBtn.MouseButton1Click:Connect(doDescend) activeBtn.MouseButton1Click:Connect(function() isActive = not isActive activeBtn.Text = "⚡ Ativo: " .. (isActive and "ON" or "OFF") activeBtn.BackgroundColor3 = isActive and Color3.fromRGB(70, 150, 110) or Color3.fromRGB(90, 90, 100) setStatus(isActive and "Mahoraga ativado." or "Mahoraga desativado (parado e inofensivo).", NEUTRAL) end) attackBtn.MouseButton1Click:Connect(function() isAggressive = not isAggressive attackBtn.Text = "🗡 Ataque: " .. (isAggressive and "ON" or "OFF") attackBtn.BackgroundColor3 = isAggressive and Color3.fromRGB(170, 70, 80) or Color3.fromRGB(90, 90, 100) setStatus(isAggressive and "Ele vai te atacar se você chegar perto." or "Ele não vai te machucar.", NEUTRAL) end) closeBtn.MouseButton1Click:Connect(function() for _, c in ipairs(connections) do pcall(function() c:Disconnect() end) end if mah then mah.model:Destroy() mah = nil end gui:Destroy() end)