-- Game Enhancer Script (Optimized) local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") -- === CONFIG === local DEFAULT_HITBOX = Vector3.new(2, 2, 1) local hitboxSize = Vector3.new(12, 12, 12) local isExpanded = false local isSpeedBoostActive = false local isInfiniteJumpActive = false local isAutoJumpActive = false local isAntiFlingActive = false local isTeleportActive = false local isFlyActive = false local autoJumpInterval = 0.5 local normalSpeed = 16 local customSpeed = 67 local MAX_SPEED = 9999 local customHitboxValue = 12 local lodEnabled = false local lodDistance = 100 local lodUpdateInterval = 2 local autoJumpTimer = 0 local VOID_THRESHOLD = -100 local lastSafePosition = nil local teleportCooldown = false local FLY_SPEED = 40 local flyBodyVelocity = nil local flyBodyGyro = nil local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local hrp = character:WaitForChild("HumanoidRootPart") -- Mobile check: hanya aktif jika TouchEnabled DAN bukan keyboard (murni mobile) local isMobile = UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled local function updateSafePosition() if not hrp then return end if hrp.Position.Y > VOID_THRESHOLD + 20 then lastSafePosition = hrp.Position end end local function getSpawnPosition() if lastSafePosition then return lastSafePosition end for _, obj in ipairs(Workspace:GetDescendants()) do if obj:IsA("SpawnLocation") then return obj.Position + Vector3.new(0, 5, 0) end end return Vector3.new(0, 10, 0) end player.CharacterAdded:Connect(function(newChar) character = newChar humanoid = newChar:WaitForChild("Humanoid") hrp = newChar:WaitForChild("HumanoidRootPart") lastSafePosition = nil teleportCooldown = false -- Reset fly jika respawn isFlyActive = false flyBodyVelocity = nil flyBodyGyro = nil if isSpeedBoostActive then humanoid.WalkSpeed = customSpeed end end) -- === GUI === local screenGui = Instance.new("ScreenGui") screenGui.Name = "GameEnhancerGui" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 420, 0, 620) frame.Position = UDim2.new(0.5, -210, 0.5, -310) frame.BackgroundColor3 = Color3.fromRGB(18, 18, 28) frame.BorderSizePixel = 0 frame.Parent = screenGui frame.Visible = false frame.ZIndex = 10 Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 10) local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 44) titleBar.BackgroundColor3 = Color3.fromRGB(30, 30, 50) titleBar.BorderSizePixel = 0 titleBar.Parent = frame titleBar.ZIndex = 11 Instance.new("UICorner", titleBar).CornerRadius = UDim.new(0, 10) local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, -50, 1, 0) titleLabel.Position = UDim2.new(0, 14, 0, 0) titleLabel.Text = "⚡ Game Enhancer" titleLabel.TextSize = 20 titleLabel.Font = Enum.Font.GothamBold titleLabel.TextColor3 = Color3.fromRGB(220, 220, 255) titleLabel.BackgroundTransparency = 1 titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.Parent = titleBar titleLabel.ZIndex = 12 local closeButton = Instance.new("TextButton") closeButton.Size = UDim2.new(0, 34, 0, 34) closeButton.Position = UDim2.new(1, -40, 0, 5) closeButton.Text = "✕" closeButton.TextSize = 16 closeButton.Font = Enum.Font.GothamBold closeButton.TextColor3 = Color3.fromRGB(255, 100, 100) closeButton.BackgroundColor3 = Color3.fromRGB(60, 20, 20) closeButton.BorderSizePixel = 0 closeButton.Parent = titleBar closeButton.ZIndex = 13 Instance.new("UICorner", closeButton).CornerRadius = UDim.new(0, 6) local contentFrame = Instance.new("ScrollingFrame") contentFrame.Size = UDim2.new(1, 0, 1, -50) contentFrame.Position = UDim2.new(0, 0, 0, 50) contentFrame.BackgroundTransparency = 1 contentFrame.ScrollBarThickness = 4 contentFrame.CanvasSize = UDim2.new(0, 0, 0, 800) contentFrame.Parent = frame contentFrame.ZIndex = 11 local layout = Instance.new("UIListLayout") layout.Padding = UDim.new(0, 8) layout.Parent = contentFrame local pad = Instance.new("UIPadding") pad.PaddingLeft = UDim.new(0, 14) pad.PaddingRight = UDim.new(0, 14) pad.PaddingTop = UDim.new(0, 10) pad.Parent = contentFrame -- === HELPERS === local function makeSection(text) local lbl = Instance.new("TextLabel") lbl.Size = UDim2.new(1, 0, 0, 22) lbl.Text = text lbl.TextSize = 12 lbl.Font = Enum.Font.GothamBold lbl.TextColor3 = Color3.fromRGB(120, 120, 180) lbl.BackgroundTransparency = 1 lbl.TextXAlignment = Enum.TextXAlignment.Left lbl.Parent = contentFrame lbl.ZIndex = 12 end local function makeToggle(labelText) local btn = Instance.new("TextButton") btn.Size = UDim2.new(1, 0, 0, 44) btn.Text = labelText .. ": OFF" btn.TextSize = 15 btn.Font = Enum.Font.Gotham btn.TextColor3 = Color3.fromRGB(220, 220, 255) btn.BackgroundColor3 = Color3.fromRGB(35, 35, 60) btn.BorderSizePixel = 0 btn.Parent = contentFrame btn.ZIndex = 12 Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 8) return btn end local function setToggleState(btn, state, label) btn.Text = label .. ": " .. (state and "ON" or "OFF") btn.BackgroundColor3 = state and Color3.fromRGB(180, 40, 40) or Color3.fromRGB(35, 35, 60) end local function makeInputRow(labelText, defaultVal, placeholder) local row = Instance.new("Frame") row.Size = UDim2.new(1, 0, 0, 44) row.BackgroundTransparency = 1 row.Parent = contentFrame row.ZIndex = 12 local lbl = Instance.new("TextLabel") lbl.Size = UDim2.new(0.5, 0, 1, 0) lbl.Text = labelText lbl.TextSize = 13 lbl.Font = Enum.Font.Gotham lbl.TextColor3 = Color3.fromRGB(180, 180, 220) lbl.BackgroundTransparency = 1 lbl.TextXAlignment = Enum.TextXAlignment.Left lbl.Parent = row lbl.ZIndex = 13 local input = Instance.new("TextBox") input.Size = UDim2.new(0.45, 0, 1, 0) input.Position = UDim2.new(0.52, 0, 0, 0) input.PlaceholderText = placeholder or tostring(defaultVal) input.Text = tostring(defaultVal) input.TextSize = 14 input.Font = Enum.Font.Gotham input.TextColor3 = Color3.fromRGB(220, 220, 255) input.BackgroundColor3 = Color3.fromRGB(28, 28, 48) input.BorderSizePixel = 0 input.ClearTextOnFocus = false input.Parent = row input.ZIndex = 13 Instance.new("UICorner", input).CornerRadius = UDim.new(0, 8) return input end local function makeButton(text, color) local btn = Instance.new("TextButton") btn.Size = UDim2.new(1, 0, 0, 38) btn.Text = text btn.TextSize = 13 btn.Font = Enum.Font.GothamBold btn.TextColor3 = Color3.fromRGB(255, 255, 255) btn.BackgroundColor3 = color or Color3.fromRGB(60, 40, 80) btn.BorderSizePixel = 0 btn.Parent = contentFrame btn.ZIndex = 12 Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 8) return btn end -- === HITBOX SECTION === makeSection("🎯 HITBOX") local expandButton = makeToggle("Expand Hitboxes") local hitboxRow = Instance.new("Frame") hitboxRow.Size = UDim2.new(1, 0, 0, 44) hitboxRow.BackgroundTransparency = 1 hitboxRow.Parent = contentFrame hitboxRow.ZIndex = 12 local hitboxInput = Instance.new("TextBox") hitboxInput.Size = UDim2.new(0.55, 0, 1, 0) hitboxInput.PlaceholderText = "Size (e.g. 15 or 20)" hitboxInput.Text = "12" hitboxInput.TextSize = 14 hitboxInput.Font = Enum.Font.Gotham hitboxInput.TextColor3 = Color3.fromRGB(220, 220, 255) hitboxInput.BackgroundColor3 = Color3.fromRGB(28, 28, 48) hitboxInput.BorderSizePixel = 0 hitboxInput.ClearTextOnFocus = false hitboxInput.Parent = hitboxRow hitboxInput.ZIndex = 13 Instance.new("UICorner", hitboxInput).CornerRadius = UDim.new(0, 8) local applyHitboxBtn = Instance.new("TextButton") applyHitboxBtn.Size = UDim2.new(0.22, 0, 1, 0) applyHitboxBtn.Position = UDim2.new(0.57, 0, 0, 0) applyHitboxBtn.Text = "Apply" applyHitboxBtn.TextSize = 13 applyHitboxBtn.Font = Enum.Font.GothamBold applyHitboxBtn.TextColor3 = Color3.fromRGB(255, 255, 255) applyHitboxBtn.BackgroundColor3 = Color3.fromRGB(50, 130, 200) applyHitboxBtn.BorderSizePixel = 0 applyHitboxBtn.Parent = hitboxRow applyHitboxBtn.ZIndex = 13 Instance.new("UICorner", applyHitboxBtn).CornerRadius = UDim.new(0, 8) local resetHitboxBtn = Instance.new("TextButton") resetHitboxBtn.Size = UDim2.new(0.19, 0, 1, 0) resetHitboxBtn.Position = UDim2.new(0.81, 0, 0, 0) resetHitboxBtn.Text = "Reset" resetHitboxBtn.TextSize = 13 resetHitboxBtn.Font = Enum.Font.GothamBold resetHitboxBtn.TextColor3 = Color3.fromRGB(255, 255, 255) resetHitboxBtn.BackgroundColor3 = Color3.fromRGB(80, 40, 40) resetHitboxBtn.BorderSizePixel = 0 resetHitboxBtn.Parent = hitboxRow resetHitboxBtn.ZIndex = 13 Instance.new("UICorner", resetHitboxBtn).CornerRadius = UDim.new(0, 8) -- === SPEED SECTION === makeSection("🚀 SPEED") local speedButton = makeToggle("Speed Boost") local speedInput = makeInputRow("Speed Value (0-9999):", 67, "67") local resetSpeedBtn = makeButton("↩ Restore Default Speed (67)", Color3.fromRGB(50, 60, 100)) -- === JUMP SECTION === makeSection("🦘 JUMP") local jumpButton = makeToggle("Infinite Jump") local autoJumpButton = makeToggle("Auto Jump") local autoJumpInput = makeInputRow("Auto Jump Interval (sec):", 0.5, "0.5") -- === FLY SECTION (MOBILE ONLY) === makeSection("✈️ FLY (Mobile Only)") local flyButton local flySpeedInput if isMobile then flyButton = makeToggle("Fly Mode") flySpeedInput = makeInputRow("Fly Speed:", 40, "40") else -- Tampilkan label info saja di PC, tidak ada tombol aktif local infoLbl = Instance.new("TextLabel") infoLbl.Size = UDim2.new(1, 0, 0, 38) infoLbl.Text = "⚠️ Fly hanya tersedia di Mobile" infoLbl.TextSize = 13 infoLbl.Font = Enum.Font.Gotham infoLbl.TextColor3 = Color3.fromRGB(160, 100, 100) infoLbl.BackgroundColor3 = Color3.fromRGB(30, 20, 20) infoLbl.BackgroundTransparency = 0 infoLbl.BorderSizePixel = 0 infoLbl.Parent = contentFrame infoLbl.ZIndex = 12 Instance.new("UICorner", infoLbl).CornerRadius = UDim.new(0, 8) end -- === ANTI FLING SECTION === makeSection("🛡️ PROTECTION") local antiFlingButton = makeToggle("Anti Fling") -- === TELEPORT SECTION === makeSection("🌀 TELEPORT") local teleportButton = makeToggle("Auto Teleport (Anti Void)") local voidInput = makeInputRow("Void Threshold (Y):", -100, "-100") local manualTpBtn = makeButton("📍 Teleport ke Spawn Sekarang", Color3.fromRGB(60, 100, 60)) -- === LOD SECTION === makeSection("🌐 LOD SETTINGS") local lodButton = makeToggle("LOD (Low Detail Far Objects)") local lodInput = makeInputRow("LOD Distance (studs):", 100, "100") -- === OPEN BUTTON === local openButton = Instance.new("TextButton") openButton.Size = UDim2.new(0, 110, 0, 34) openButton.Position = UDim2.new(0, 10, 0, 10) openButton.Text = "⚡ Enhancer" openButton.TextSize = 14 openButton.Font = Enum.Font.GothamBold openButton.TextColor3 = Color3.fromRGB(255, 255, 255) openButton.BackgroundColor3 = Color3.fromRGB(50, 90, 200) openButton.BorderSizePixel = 0 openButton.Parent = screenGui openButton.ZIndex = 5 Instance.new("UICorner", openButton).CornerRadius = UDim.new(0, 8) -- ======================== -- FLY SYSTEM (MOBILE ONLY) -- Menggunakan BodyVelocity + BodyGyro di HRP -- Arah gerak = arah camera (LookVector) -- Kontrol: UP naik, DOWN turun, movement joystick bawaan Roblox untuk maju/mundur/kiri/kanan -- TIDAK mengganggu camera sama sekali karena tidak ada input custom -- ======================== -- Fly UP / DOWN button (kanan bawah layar, hanya muncul saat fly aktif dan mobile) local flyUpBtn = nil local flyDownBtn = nil local flyUpHeld = false local flyDownHeld = false local function createFlyButtons() if not isMobile then return end flyUpBtn = Instance.new("TextButton") flyUpBtn.Size = UDim2.new(0, 70, 0, 70) flyUpBtn.Position = UDim2.new(1, -85, 1, -180) flyUpBtn.Text = "▲\nUP" flyUpBtn.TextSize = 14 flyUpBtn.Font = Enum.Font.GothamBold flyUpBtn.TextColor3 = Color3.fromRGB(255, 255, 255) flyUpBtn.BackgroundColor3 = Color3.fromRGB(40, 100, 180) flyUpBtn.BackgroundTransparency = 0.2 flyUpBtn.BorderSizePixel = 0 flyUpBtn.Visible = false flyUpBtn.Parent = screenGui flyUpBtn.ZIndex = 25 Instance.new("UICorner", flyUpBtn).CornerRadius = UDim.new(0.5, 0) flyDownBtn = Instance.new("TextButton") flyDownBtn.Size = UDim2.new(0, 70, 0, 70) flyDownBtn.Position = UDim2.new(1, -85, 1, -100) flyDownBtn.Text = "▼\nDOWN" flyDownBtn.TextSize = 14 flyDownBtn.Font = Enum.Font.GothamBold flyDownBtn.TextColor3 = Color3.fromRGB(255, 255, 255) flyDownBtn.BackgroundColor3 = Color3.fromRGB(100, 40, 180) flyDownBtn.BackgroundTransparency = 0.2 flyDownBtn.BorderSizePixel = 0 flyDownBtn.Visible = false flyDownBtn.Parent = screenGui flyDownBtn.ZIndex = 25 Instance.new("UICorner", flyDownBtn).CornerRadius = UDim.new(0.5, 0) -- Hold detection UP flyUpBtn.InputBegan:Connect(function(inp) if inp.UserInputType == Enum.UserInputType.Touch then flyUpHeld = true end end) flyUpBtn.InputEnded:Connect(function(inp) if inp.UserInputType == Enum.UserInputType.Touch then flyUpHeld = false end end) -- Hold detection DOWN flyDownBtn.InputBegan:Connect(function(inp) if inp.UserInputType == Enum.UserInputType.Touch then flyDownHeld = true end end) flyDownBtn.InputEnded:Connect(function(inp) if inp.UserInputType == Enum.UserInputType.Touch then flyDownHeld = false end end) end createFlyButtons() local function startFly() if not isMobile then return end if not hrp then return end -- Buat BodyVelocity flyBodyVelocity = Instance.new("BodyVelocity") flyBodyVelocity.Velocity = Vector3.zero flyBodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5) flyBodyVelocity.P = 1e4 flyBodyVelocity.Parent = hrp -- Buat BodyGyro (jaga orientasi agar tidak terbalik) flyBodyGyro = Instance.new("BodyGyro") flyBodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5) flyBodyGyro.P = 1e4 flyBodyGyro.D = 100 flyBodyGyro.CFrame = hrp.CFrame flyBodyGyro.Parent = hrp -- Nonaktifkan gravitasi humanoid sementara humanoid.PlatformStand = true if flyUpBtn then flyUpBtn.Visible = true end if flyDownBtn then flyDownBtn.Visible = true end end local function stopFly() if not isMobile then return end if flyBodyVelocity then flyBodyVelocity:Destroy() flyBodyVelocity = nil end if flyBodyGyro then flyBodyGyro:Destroy() flyBodyGyro = nil end -- Kembalikan humanoid normal if humanoid then humanoid.PlatformStand = false end flyUpHeld = false flyDownHeld = false if flyUpBtn then flyUpBtn.Visible = false end if flyDownBtn then flyDownBtn.Visible = false end end local function toggleFly() if not isMobile then return end isFlyActive = not isFlyActive setToggleState(flyButton, isFlyActive, "Fly Mode") if isFlyActive then startFly() else stopFly() end end -- === LOGIC FUNCTIONS === local function expandHitboxes() for _, p in pairs(Players:GetPlayers()) do if p ~= Players.LocalPlayer and p.Character then local hum = p.Character:FindFirstChild("Humanoid") local root = p.Character:FindFirstChild("HumanoidRootPart") if root then if hum and hum.Health > 0 and isExpanded then root.Size = hitboxSize root.Transparency = 0.5 else root.Size = DEFAULT_HITBOX root.Transparency = 1 end root.CanCollide = false end end end end local function applyHitboxSize() local val = tonumber(hitboxInput.Text) if val and val > 0 and val <= 100 then customHitboxValue = val hitboxSize = Vector3.new(val, val, val) if isExpanded then expandHitboxes() end else hitboxInput.Text = tostring(customHitboxValue) end end local function resetHitbox() customHitboxValue = 12 hitboxSize = Vector3.new(12, 12, 12) hitboxInput.Text = "12" isExpanded = false setToggleState(expandButton, false, "Expand Hitboxes") expandHitboxes() end local function doInfiniteJump() local hum = character and character:FindFirstChildOfClass("Humanoid") if not hum then return end local state = hum:GetState() if state == Enum.HumanoidStateType.Freefall or state == Enum.HumanoidStateType.Jumping then hum:ChangeState(Enum.HumanoidStateType.Jumping) end end local function doAutoJump() local hum = character and character:FindFirstChildOfClass("Humanoid") if hum then hum:ChangeState(Enum.HumanoidStateType.Jumping) end end local function doTeleportToMap() if not hrp then return end local target = getSpawnPosition() hrp.CFrame = CFrame.new(target) hrp.AssemblyLinearVelocity = Vector3.zero hrp.AssemblyAngularVelocity = Vector3.zero end local function toggleGui() frame.Visible = not frame.Visible end local function toggleExpand() isExpanded = not isExpanded setToggleState(expandButton, isExpanded, "Expand Hitboxes") expandHitboxes() end local function toggleSpeed() isSpeedBoostActive = not isSpeedBoostActive local val = tonumber(speedInput.Text) if val and val >= 0 and val <= MAX_SPEED then customSpeed = val else speedInput.Text = tostring(customSpeed) end setToggleState(speedButton, isSpeedBoostActive, "Speed Boost") end local function toggleInfiniteJump() isInfiniteJumpActive = not isInfiniteJumpActive setToggleState(jumpButton, isInfiniteJumpActive, "Infinite Jump") end local function toggleAutoJump() isAutoJumpActive = not isAutoJumpActive setToggleState(autoJumpButton, isAutoJumpActive, "Auto Jump") end local function toggleAntiFling() isAntiFlingActive = not isAntiFlingActive setToggleState(antiFlingButton, isAntiFlingActive, "Anti Fling") end local function toggleTeleport() isTeleportActive = not isTeleportActive setToggleState(teleportButton, isTeleportActive, "Auto Teleport (Anti Void)") end local function toggleLOD() lodEnabled = not lodEnabled setToggleState(lodButton, lodEnabled, "LOD (Low Detail Far Objects)") end local function applyLOD() if not hrp then return end local camPos = Workspace.CurrentCamera and Workspace.CurrentCamera.CFrame.Position or hrp.Position local dist = tonumber(lodInput.Text) or lodDistance for _, obj in ipairs(Workspace:GetDescendants()) do if obj:IsA("BasePart") and obj ~= hrp then pcall(function() obj.RenderFidelity = (lodEnabled and (obj.Position - camPos).Magnitude > dist) and Enum.RenderFidelity.Performance or Enum.RenderFidelity.Automatic end) end end end local function applyAntiFling() if not isAntiFlingActive then return end local root = character and character:FindFirstChild("HumanoidRootPart") if not root then return end local maxVel = isSpeedBoostActive and (customSpeed * 1.5) or 80 local vel = root.AssemblyLinearVelocity if vel.Magnitude > maxVel then root.AssemblyLinearVelocity = vel.Unit * maxVel end end -- === CONNECT === openButton.MouseButton1Click:Connect(toggleGui) closeButton.MouseButton1Click:Connect(toggleGui) expandButton.MouseButton1Click:Connect(toggleExpand) speedButton.MouseButton1Click:Connect(toggleSpeed) jumpButton.MouseButton1Click:Connect(toggleInfiniteJump) autoJumpButton.MouseButton1Click:Connect(toggleAutoJump) antiFlingButton.MouseButton1Click:Connect(toggleAntiFling) teleportButton.MouseButton1Click:Connect(toggleTeleport) lodButton.MouseButton1Click:Connect(toggleLOD) applyHitboxBtn.MouseButton1Click:Connect(applyHitboxSize) resetHitboxBtn.MouseButton1Click:Connect(resetHitbox) manualTpBtn.MouseButton1Click:Connect(doTeleportToMap) if isMobile and flyButton then flyButton.MouseButton1Click:Connect(toggleFly) end resetSpeedBtn.MouseButton1Click:Connect(function() customSpeed = 67 speedInput.Text = "67" if isSpeedBoostActive then setToggleState(speedButton, true, "Speed Boost") end end) UserInputService.JumpRequest:Connect(function() if isInfiniteJumpActive then doInfiniteJump() end end) -- === MAIN LOOP === local hitboxTick = 0 local lodTick = 0 local safePosTimer = 0 RunService.RenderStepped:Connect(function(dt) -- SPEED local hum = character and character:FindFirstChildOfClass("Humanoid") if hum then if isSpeedBoostActive then local val = tonumber(speedInput.Text) hum.WalkSpeed = (val and val >= 0 and val <= MAX_SPEED) and val or customSpeed else if not isFlyActive then hum.WalkSpeed = normalSpeed end end end -- ANTI FLING (skip saat fly aktif) if not isFlyActive then applyAntiFling() end -- SAFE POSITION safePosTimer += dt if safePosTimer >= 0.5 then safePosTimer = 0 updateSafePosition() end -- AUTO TELEPORT VOID if isTeleportActive and hrp and not teleportCooldown and not isFlyActive then local threshold = tonumber(voidInput.Text) or VOID_THRESHOLD if hrp.Position.Y < threshold then teleportCooldown = true doTeleportToMap() task.delay(2, function() teleportCooldown = false end) end end -- HITBOX hitboxTick += dt if hitboxTick >= 0.1 then hitboxTick = 0 expandHitboxes() end -- AUTO JUMP (tidak aktif saat fly) if isAutoJumpActive and not isFlyActive then autoJumpTimer += dt local interval = tonumber(autoJumpInput.Text) or autoJumpInterval if autoJumpTimer >= interval then autoJumpTimer = 0 doAutoJump() end else autoJumpTimer = 0 end -- LOD lodTick += dt if lodTick >= lodUpdateInterval then lodTick = 0 if lodEnabled then applyLOD() end end -- ===================== -- FLY LOOP (MOBILE ONLY) -- Menggunakan MoveDirection dari Humanoid (dari joystick bawaan Roblox) -- TIDAK ada input custom → camera tidak terganggu sama sekali -- ===================== if isFlyActive and isMobile and flyBodyVelocity and hrp then local cam = Workspace.CurrentCamera local flySpd = tonumber(flySpeedInput and flySpeedInput.Text) or FLY_SPEED -- Ambil arah gerak dari joystick bawaan Roblox (MoveDirection = sudah relatif ke camera) local moveDir = Vector3.zero if hum then moveDir = hum.MoveDirection end -- Arah horizontal dari camera local camCF = cam.CFrame local flatLook = Vector3.new(camCF.LookVector.X, 0, camCF.LookVector.Z).Unit local flatRight = Vector3.new(camCF.RightVector.X, 0, camCF.RightVector.Z).Unit -- Velocity horizontal mengikuti joystick local horizVel = Vector3.zero if moveDir.Magnitude > 0.1 then -- Proyeksikan MoveDirection ke look dan right camera local fwd = Vector3.new(moveDir.X, 0, moveDir.Z) horizVel = fwd * flySpd end -- Velocity vertikal dari tombol UP / DOWN local vertVel = 0 if flyUpHeld then vertVel = flySpd elseif flyDownHeld then vertVel = -flySpd end flyBodyVelocity.Velocity = Vector3.new(horizVel.X, vertVel, horizVel.Z) -- Gyro: jaga karakter tetap tegak, hadap ke arah gerak jika ada if moveDir.Magnitude > 0.1 then local targetCF = CFrame.new(hrp.Position, hrp.Position + Vector3.new(moveDir.X, 0, moveDir.Z)) flyBodyGyro.CFrame = targetCF else flyBodyGyro.CFrame = CFrame.new(hrp.Position) * CFrame.Angles(0, cam.CFrame:ToEulerAnglesYXZ(), 0) end end end) -- === DRAGGING === local dragging, dragInput, 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) titleBar.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging 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)