-- Universal C-137 Portal Gun (Fixed Cylinder Vertical Rotation) local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer -- Безопасный поиск контейнера для интерфейса local function getGuiContainer() if gethui then local ok, res = pcall(gethui) if ok and res then return res end end return player:WaitForChild("PlayerGui", 5) or game:GetService("CoreGui") end -- ==================================================================== -- 0. БЕЗОПАСНЫЕ ЗВУКИ -- ==================================================================== local SOUNDS = { OPEN = 1013378689, TELEPORT = 289556450, CLOSE = 210114962 } local function playSound(soundId, volume, pitch, parent) pcall(function() local sound = Instance.new("Sound") sound.SoundId = "rbxassetid://" .. tostring(soundId) sound.Volume = volume or 0.2 sound.Pitch = pitch or 1 sound.Parent = parent or workspace sound:Play() game:GetService("Debris"):AddItem(sound, 4) end) end -- ==================================================================== -- 1. ДЕТАЛИЗИРОВАННАЯ 3D-ПУШКА (ИСПРАВЛЕНА ОРИЕНТАЦИЯ КОЛБЫ) -- ==================================================================== local function buildHighDetailGun(tool) local handle = Instance.new("Part") handle.Name = "Handle" handle.Size = Vector3.new(0.3, 0.8, 0.3) handle.Transparency = 1 handle.Parent = tool tool.PrimaryPart = handle local function createPart(size, cframe, color, material, shape) local p = Instance.new("Part") p.Size = size p.Color = color or Color3.fromRGB(200, 200, 200) p.Material = material or Enum.Material.SmoothPlastic p.CanCollide = false p.Massless = true if shape then p.Shape = shape end p.Parent = tool local weld = Instance.new("WeldConstraint") weld.Part0 = handle weld.Part1 = p weld.Parent = p p.CFrame = handle.CFrame * cframe return p end -- Основной корпус createPart(Vector3.new(0.85, 0.45, 1.8), CFrame.new(0, 0.4, -0.4), Color3.fromRGB(185, 190, 195)) -- Рукоятка local grip = createPart(Vector3.new(0.9, 0.35, 0.35), CFrame.new(0, -0.2, 0.1) * CFrame.Angles(0, 0, math.rad(90)) * CFrame.Angles(math.rad(-15), 0, 0), Color3.fromRGB(130, 135, 140), Enum.Material.SmoothPlastic, Enum.PartType.Cylinder) -- Дисплей createPart(Vector3.new(0.3, 0.18, 0.18), CFrame.new(0, 0.63, 0.35), Color3.fromRGB(30, 30, 30)) createPart(Vector3.new(0.55, 0.02, 0.35), CFrame.new(0, 0.63, 0.05), Color3.fromRGB(220, 30, 30), Enum.Material.Glass) -- === ВЕРТИКАЛЬНАЯ КОЛБА И ОСНОВАНИЕ (ПОВОРОТ ПО Z НА 90 ДЛЯ ВЕРТИКАЛИ) === -- Разворачиваем цилиндр Roblox так, чтобы его высота была направлена ВВЕРХ (по Y) local verticalCylinderRotation = CFrame.Angles(0, 0, math.rad(90)) -- Металлическое основание под колбу createPart(Vector3.new(0.1, 0.65, 0.65), CFrame.new(0, 0.65, -0.6) * verticalCylinderRotation, Color3.fromRGB(170, 175, 180), Enum.Material.SmoothPlastic, Enum.PartType.Cylinder) -- СТЕКЛЯННАЯ КОЛБА (Теперь вытянута строго вертикально!) local bulbGlass = createPart(Vector3.new(0.85, 0.55, 0.55), CFrame.new(0, 1.05, -0.6) * verticalCylinderRotation, Color3.fromRGB(200, 255, 200), Enum.Material.Glass, Enum.PartType.Cylinder) bulbGlass.Transparency = 0.65 -- Зеленая шарообразная энергия внутри колбы local core = createPart(Vector3.new(0.35, 0.35, 0.35), CFrame.new(0, 1.0, -0.6), Color3.fromRGB(0, 255, 60), Enum.Material.Neon, Enum.PartType.Ball) local light = Instance.new("PointLight", core) light.Color = Color3.fromRGB(50, 255, 80) light.Range = 5 light.Brightness = 2 local coreSparks = Instance.new("ParticleEmitter", core) coreSparks.Texture = "rbxassetid://243664672" coreSparks.Color = ColorSequence.new(Color3.fromRGB(50, 255, 100)) coreSparks.Size = NumberSequence.new(0.18, 0.03) coreSparks.Lifetime = NumberRange.new(0.15, 0.3) coreSparks.Rate = 22 coreSparks.Speed = NumberRange.new(0.5, 1.2) -- Передняя часть дула createPart(Vector3.new(0.86, 0.46, 0.05), CFrame.new(0, 0.4, -1.3), Color3.fromRGB(60, 65, 70)) for i = -1, 1 do local lens = createPart(Vector3.new(0.08, 0.2, 0.2), CFrame.new(i * 0.26, 0.4, -1.31) * verticalCylinderRotation, Color3.fromRGB(0, 255, 70), Enum.Material.Neon, Enum.PartType.Cylinder) end end local function givePortalGun() local bp = player:FindFirstChild("Backpack") if not bp then return end if bp:FindFirstChild("Portal Gun") or (player.Character and player.Character:FindFirstChild("Portal Gun")) then return end local tool = Instance.new("Tool") tool.Name = "Portal Gun" tool.Grip = CFrame.new(0, 0, 0) buildHighDetailGun(tool) tool.Parent = bp end task.spawn(function() task.wait(0.5) givePortalGun() end) player.CharacterAdded:Connect(function() task.wait(1) givePortalGun() end) -- ==================================================================== -- 2. УНИВЕРСАЛЬНОЕ МЕНЮ -- ==================================================================== local guiTarget = getGuiContainer() if guiTarget:FindFirstChild("RickPortalMenuV16_Fix") then guiTarget.RickPortalMenuV16_Fix:Destroy() end local screenGui = Instance.new("ScreenGui") screenGui.Name = "RickPortalMenuV16_Fix" screenGui.ResetOnSpawn = false screenGui.Parent = guiTarget local frame = Instance.new("Frame", screenGui) frame.Size = UDim2.new(0, 200, 0, 255) frame.Position = UDim2.new(0.02, 0, 0.25, 0) frame.BackgroundColor3 = Color3.fromRGB(15, 18, 22) frame.ClipsDescendants = true frame.Active = true frame.Draggable = true frame.Visible = false Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 6) local title = Instance.new("TextLabel", frame) title.Size = UDim2.new(1, 0, 0, 20) title.Text = " PORTAL GUN C-137" title.TextColor3 = Color3.fromRGB(50, 255, 100) title.BackgroundColor3 = Color3.fromRGB(20, 25, 30) title.BackgroundTransparency = 0.2 title.Font = Enum.Font.SourceSansBold title.TextSize = 11 title.TextXAlignment = Enum.TextXAlignment.Left Instance.new("UICorner", title).CornerRadius = UDim.new(0, 6) local btnMinimize = Instance.new("TextButton", title) btnMinimize.Size = UDim2.new(0, 18, 0, 14) btnMinimize.Position = UDim2.new(1, -20, 0, 3) btnMinimize.Text = "—" btnMinimize.TextColor3 = Color3.fromRGB(200, 200, 200) btnMinimize.BackgroundColor3 = Color3.fromRGB(40, 45, 50) btnMinimize.Font = Enum.Font.SourceSansBold btnMinimize.TextSize = 10 Instance.new("UICorner", btnMinimize).CornerRadius = UDim.new(0, 3) local contentFrame = Instance.new("Frame", frame) contentFrame.Size = UDim2.new(1, 0, 1, -20) contentFrame.Position = UDim2.new(0, 0, 0, 20) contentFrame.BackgroundTransparency = 1 local isMinimized = false btnMinimize.MouseButton1Click:Connect(function() isMinimized = not isMinimized if isMinimized then frame:TweenSize(UDim2.new(0, 200, 0, 20), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true) contentFrame.Visible = false btnMinimize.Text = "+" else frame:TweenSize(UDim2.new(0, 200, 0, 255), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true) task.wait(0.1) contentFrame.Visible = true btnMinimize.Text = "—" end end) local coordDisplay = Instance.new("TextLabel", contentFrame) coordDisplay.Size = UDim2.new(0.92, 0, 0, 12) coordDisplay.Position = UDim2.new(0.04, 0, 0, 2) coordDisplay.Text = "XYZ: 0, 0, 0" coordDisplay.TextColor3 = Color3.fromRGB(180, 255, 180) coordDisplay.BackgroundTransparency = 1 coordDisplay.TextSize = 10 coordDisplay.Font = Enum.Font.SourceSansBold -- === БЛОКИ XYZ === local function createXYZBlock(yPos, placeholder, btnColor) local inp = Instance.new("TextBox", contentFrame) inp.Size = UDim2.new(0.58, 0, 0, 20) inp.Position = UDim2.new(0.04, 0, 0, yPos) inp.PlaceholderText = placeholder inp.BackgroundColor3 = Color3.fromRGB(20, 25, 30) inp.BackgroundTransparency = 0.2 inp.TextColor3 = Color3.new(1, 1, 1) inp.TextSize = 10 inp.ClearTextOnFocus = false Instance.new("UICorner", inp).CornerRadius = UDim.new(0, 4) local btnSave = Instance.new("TextButton", contentFrame) btnSave.Size = UDim2.new(0.32, 0, 0, 20) btnSave.Position = UDim2.new(0.64, 0, 0, yPos) btnSave.Text = "📍 Записать" btnSave.BackgroundColor3 = Color3.fromRGB(200, 130, 0) btnSave.Font = Enum.Font.SourceSansBold btnSave.TextColor3 = Color3.new(1, 1, 1) btnSave.TextSize = 9 Instance.new("UICorner", btnSave).CornerRadius = UDim.new(0, 4) local btnTele = Instance.new("TextButton", contentFrame) btnTele.Size = UDim2.new(0.92, 0, 0, 20) btnTele.Position = UDim2.new(0.04, 0, 0, yPos + 23) btnTele.Text = "Портал на " .. placeholder btnTele.BackgroundColor3 = btnColor btnTele.Font = Enum.Font.SourceSansBold btnTele.TextColor3 = Color3.new(1, 1, 1) btnTele.TextSize = 10 Instance.new("UICorner", btnTele).CornerRadius = UDim.new(0, 4) btnSave.MouseButton1Click:Connect(function() local p = player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character.HumanoidRootPart.Position if p then inp.Text = string.format("%.0f, %.0f, %.0f", p.X, p.Y, p.Z) end end) return inp, btnTele end local inputCoords1, btnCreateCoords1 = createXYZBlock(16, "XYZ-1", Color3.fromRGB(0, 180, 80)) local inputCoords2, btnCreateCoords2 = createXYZBlock(64, "XYZ-2", Color3.fromRGB(0, 140, 180)) local inputCoords3, btnCreateCoords3 = createXYZBlock(112, "XYZ-3", Color3.fromRGB(0, 100, 200)) -- === БЛОК ИГРОК === local inputPlayer = Instance.new("TextBox", contentFrame) inputPlayer.Size = UDim2.new(0.92, 0, 0, 20) inputPlayer.Position = UDim2.new(0.04, 0, 0, 160) inputPlayer.PlaceholderText = "Имя игрока" inputPlayer.BackgroundColor3 = Color3.fromRGB(20, 25, 30) inputPlayer.BackgroundTransparency = 0.2 inputPlayer.TextColor3 = Color3.new(1, 1, 1) inputPlayer.TextSize = 10 inputPlayer.ClearTextOnFocus = false Instance.new("UICorner", inputPlayer).CornerRadius = UDim.new(0, 4) local btnTeleportPlayer = Instance.new("TextButton", contentFrame) btnTeleportPlayer.Size = UDim2.new(0.92, 0, 0, 20) btnTeleportPlayer.Position = UDim2.new(0.04, 0, 0, 183) btnTeleportPlayer.Text = "Портал к Игроку" btnTeleportPlayer.BackgroundColor3 = Color3.fromRGB(110, 0, 180) btnTeleportPlayer.Font = Enum.Font.SourceSansBold btnTeleportPlayer.TextColor3 = Color3.new(1, 1, 1) btnTeleportPlayer.TextSize = 10 Instance.new("UICorner", btnTeleportPlayer).CornerRadius = UDim.new(0, 4) local statusLabel = Instance.new("TextLabel", contentFrame) statusLabel.Size = UDim2.new(0.92, 0, 0, 14) statusLabel.Position = UDim2.new(0.04, 0, 0, 208) statusLabel.Text = "Готов к выстрелу" statusLabel.TextColor3 = Color3.fromRGB(0, 255, 150) statusLabel.BackgroundTransparency = 1 statusLabel.TextSize = 10 statusLabel.Font = Enum.Font.SourceSansBold -- ==================================================================== -- 3. СОЗДАНИЕ ПОРТАЛА -- ==================================================================== local function buildVerticalPortalDisk(cframe) local model = Instance.new("Model") model.Name = "StandingPortalModel" model.Parent = workspace local baseCF = cframe * CFrame.Angles(0, math.rad(90), 0) local outerRing = Instance.new("Part") outerRing.Name = "StandingPortal" outerRing.Size = Vector3.new(1, 1, 1) outerRing.CFrame = baseCF outerRing.Color = Color3.fromRGB(20, 255, 60) outerRing.Material = Enum.Material.Neon outerRing.Transparency = 0.2 outerRing.Anchored = true outerRing.CanCollide = false outerRing.Parent = model local outerMesh = Instance.new("SpecialMesh", outerRing) outerMesh.MeshType = Enum.MeshType.Sphere outerMesh.Scale = Vector3.new(0.4, 10.2, 8.0) local innerCore = Instance.new("Part") innerCore.Name = "Core" innerCore.Size = Vector3.new(1, 1, 1) innerCore.CFrame = baseCF innerCore.Color = Color3.fromRGB(220, 255, 220) innerCore.Material = Enum.Material.Neon innerCore.Transparency = 0.25 innerCore.Anchored = true innerCore.CanCollide = false innerCore.Parent = model local innerMesh = Instance.new("SpecialMesh", innerCore) innerMesh.MeshType = Enum.MeshType.Sphere innerMesh.Scale = Vector3.new(0.2, 7.2, 5.2) local attGreen = Instance.new("Attachment", outerRing) local particlesGreen = Instance.new("ParticleEmitter", attGreen) particlesGreen.Texture = "rbxassetid://258121021" particlesGreen.Color = ColorSequence.new({ ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)), ColorSequenceKeypoint.new(0.5, Color3.fromRGB(80, 255, 120)), ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 200, 50)) }) particlesGreen.Size = NumberSequence.new(0.5, 0.1) particlesGreen.Lifetime = NumberRange.new(0.8, 1.4) particlesGreen.Rate = 35 particlesGreen.Speed = NumberRange.new(2, 5) particlesGreen.SpreadAngle = Vector2.new(360, 360) local attSparks = Instance.new("Attachment", outerRing) local whiteSparks = Instance.new("ParticleEmitter", attSparks) whiteSparks.Texture = "rbxassetid://258121021" whiteSparks.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255)) whiteSparks.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0.2), NumberSequenceKeypoint.new(0.5, 0.1), NumberSequenceKeypoint.new(1, 0) }) whiteSparks.Lifetime = NumberRange.new(0.6, 1.2) whiteSparks.Rate = 50 whiteSparks.Speed = NumberRange.new(6, 12) whiteSparks.SpreadAngle = Vector2.new(360, 360) local light = Instance.new("PointLight", outerRing) light.Color = Color3.fromRGB(40, 255, 80) light.Range = 10 light.Brightness = 1.8 task.delay(4.6, function() if outerRing and outerRing.Parent then playSound(SOUNDS.CLOSE, 0.2, 1.3, outerRing) end end) game:GetService("Debris"):AddItem(model, 5) return outerRing end -- ==================================================================== -- 4. ВЫСТРЕЛ ВПЕРЁД -- ==================================================================== local function launchPortalProjectile(startCFrame, targetPosition, onHitCallback) local proj = Instance.new("Part") proj.Name = "PortalEnergyBall" proj.Size = Vector3.new(0.5, 0.5, 0.5) proj.Shape = Enum.PartType.Ball proj.Color = Color3.fromRGB(0, 255, 100) proj.Material = Enum.Material.Neon proj.CanCollide = false proj.Anchored = true proj.CFrame = startCFrame proj.Parent = workspace local light = Instance.new("PointLight", proj) light.Color = Color3.fromRGB(50, 255, 100) light.Range = 6 light.Brightness = 2 local trail = Instance.new("ParticleEmitter", proj) trail.Texture = "rbxassetid://243664672" trail.Color = ColorSequence.new(Color3.fromRGB(50, 255, 100)) trail.Size = NumberSequence.new(0.3, 0) trail.Lifetime = NumberRange.new(0.15, 0.25) trail.Rate = 90 trail.Speed = NumberRange.new(1, 2) local startPos = startCFrame.Position local distance = (targetPosition - startPos).Magnitude local speed = 45 local duration = math.clamp(distance / speed, 0.15, 1.2) local elapsed = 0 local connection connection = RunService.Heartbeat:Connect(function(dt) elapsed = elapsed + dt local alpha = math.clamp(elapsed / duration, 0, 1) proj.Position = startPos:Lerp(targetPosition, alpha) if alpha >= 1 then connection:Disconnect() proj:Destroy() if onHitCallback then onHitCallback() end end end) end local function executeTwoWayPortal(targetVectorB) local char = player.Character if not (char and char:FindFirstChild("HumanoidRootPart")) then return end local root = char.HumanoidRootPart local forwardVector = root.CFrame.LookVector local gunMuzzlePos = root.Position + (forwardVector * 2.5) + Vector3.new(0, 0.5, 0) local spawnPosA = root.Position + (forwardVector * 8) + Vector3.new(0, 0.5, 0) local spawnCFrameA = CFrame.new(spawnPosA, spawnPosA + forwardVector) local spawnCFrameB = CFrame.new(targetVectorB) local originVectorA = root.Position statusLabel.Text = "Выстрел..." launchPortalProjectile(CFrame.new(gunMuzzlePos, gunMuzzlePos + forwardVector), spawnCFrameA.Position, function() playSound(SOUNDS.OPEN, 0.25, 1, root) local portalA = buildVerticalPortalDisk(spawnCFrameA) playSound(SOUNDS.OPEN, 0.25, 1, nil) local portalB = buildVerticalPortalDisk(spawnCFrameB) local coolDownA, coolDownB = false, false portalA.Touched:Connect(function(hit) if hit:IsDescendantOf(char) and not coolDownA then coolDownB = true statusLabel.Text = "В Точку B!" playSound(SOUNDS.TELEPORT, 0.25, 1.1, root) root.CFrame = CFrame.new(targetVectorB) + Vector3.new(0, 3, 3) task.wait(1.5) coolDownB = false end end) portalB.Touched:Connect(function(hit) if hit:IsDescendantOf(char) and not coolDownB then coolDownA = true statusLabel.Text = "Обратно в Точку A!" playSound(SOUNDS.TELEPORT, 0.25, 1.1, root) root.CFrame = CFrame.new(originVectorA) + Vector3.new(0, 3, 3) task.wait(1.5) coolDownA = false end end) statusLabel.Text = "Связь готова!" end) end local function parseVector(text) local x, y, z = text:match("(%-?%d+%.?%d*)%s*[,%s]%s*(%-?%d+%.?%d*)%s*[,%s]%s*(%-?%d+%.?%d*)") if x and y and z then return Vector3.new(tonumber(x), tonumber(y), tonumber(z)) end return nil end RunService.RenderStepped:Connect(function() local char = player.Character if char then local hasGun = char:FindFirstChild("Portal Gun") ~= nil frame.Visible = hasGun if hasGun and char:FindFirstChild("HumanoidRootPart") then local p = char.HumanoidRootPart.Position coordDisplay.Text = string.format("XYZ: %.0f, %.0f, %.0f", p.X, p.Y, p.Z) end else frame.Visible = false end end) local function connectPortalBtn(btn, inputObj, labelName) btn.MouseButton1Click:Connect(function() local vec = parseVector(inputObj.Text) if vec then executeTwoWayPortal(vec) else statusLabel.Text = labelName .. " пустой!" end end) end connectPortalBtn(btnCreateCoords1, inputCoords1, "XYZ-1") connectPortalBtn(btnCreateCoords2, inputCoords2, "XYZ-2") connectPortalBtn(btnCreateCoords3, inputCoords3, "XYZ-3") btnTeleportPlayer.MouseButton1Click:Connect(function() local targetName = string.lower(inputPlayer.Text) if targetName == "" then statusLabel.Text = "Введите имя!" return end for _, p in pairs(Players:GetPlayers()) do if p ~= player and string.find(string.lower(p.Name), targetName) then if p.Character and p.Character:FindFirstChild("HumanoidRootPart") then executeTwoWayPortal(p.Character.HumanoidRootPart.Position) return end end end statusLabel.Text = "Игрок не найден!" end)