local Players = game:GetService("Players") local TweenService = game:GetService("TweenService") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local character, humanoid, humanoidRootPart local originalPosition, originalCFrame local isTeleporting = false local WEAPON_LOCATIONS = { M4A1 = { position = Vector3.new(847.05, 97.9, 2229.76), model = nil }, Remington870 = { position = Vector3.new(820.13, 97.9, 2229.85), model = nil } } local TELEPORT_SPEED = 100000000 local RETURN_DELAY = 0.5 local PICKUP_RANGE = 5 local screenGui, frame, m4Button, remButton, toggleButton local isUIVisible = true local function initializeCharacter() character = player.Character or player.CharacterAdded:Wait() player.CharacterAdded:Connect(function(newCharacter) character = newCharacter initializeCharacter() end) humanoid = character:WaitForChild("Humanoid") humanoidRootPart = character:WaitForChild("HumanoidRootPart") print("Персонаж инициализирован:", character.Name) originalPosition = humanoidRootPart.Position originalCFrame = humanoidRootPart.CFrame humanoid.Died:Connect(function() print("Персонаж умер, сброс состояния телепортации...") isTeleporting = false end) end initializeCharacter() local function findWeaponModel(position, weaponName) local radius = 10 local weapons = workspace:GetChildren() for _, obj in ipairs(weapons) do if obj:IsA("Model") and obj.PrimaryPart then local distance = (obj.PrimaryPart.Position - position).Magnitude if distance <= radius then if obj.Name:find("M4A1") or obj.Name:find("Remington") or obj.Name:find("Gun") then print("Найдено оружие:", obj.Name, "на расстоянии", distance) return obj end end end end for _, obj in ipairs(workspace:GetDescendants()) do if obj:IsA("Tool") and obj:FindFirstChild("Handle") then local distance = (obj.Handle.Position - position).Magnitude if distance <= radius then print("Найден инструмент:", obj.Name, "на расстоянии", distance) return obj end end end return nil end for weaponName, data in pairs(WEAPON_LOCATIONS) do data.model = findWeaponModel(data.position, weaponName) if data.model then print(weaponName .. " найден!") else print(weaponName .. " не найден по координатам") end end local function smoothTeleport(targetCFrame, duration) if isTeleporting or not humanoidRootPart or not humanoid then print("Ошибка: невозможно телепортироваться") return nil end isTeleporting = true humanoid.PlatformStand = true local startTime = tick() local startCFrame = humanoidRootPart.CFrame local connection connection = RunService.Heartbeat:Connect(function() if not humanoidRootPart or humanoid.Health <= 0 then connection:Disconnect() isTeleporting = false return end local elapsed = tick() - startTime local alpha = math.min(elapsed / duration, 1) local easedAlpha = alpha * alpha humanoidRootPart.CFrame = startCFrame:Lerp(targetCFrame, easedAlpha) if alpha >= 1 then connection:Disconnect() if humanoidRootPart then humanoidRootPart.CFrame = targetCFrame end isTeleporting = false if humanoid then humanoid.PlatformStand = false end end end) return connection end local function isCharacterValid() return character and humanoid and humanoidRootPart and humanoid.Health > 0 end local function teleportForWeapon(weaponName) if not isCharacterValid() then print("Ошибка: персонаж недоступен или мертв") return end if isTeleporting then print("Уже выполняется телепортация") return end local weaponData = WEAPON_LOCATIONS[weaponName] if not weaponData then warn("Оружие не найдено в конфигурации:", weaponName) return end originalPosition = humanoidRootPart.Position originalCFrame = humanoidRootPart.CFrame local targetPosition = weaponData.position + Vector3.new(0, 2, 0) local targetCFrame = CFrame.new(targetPosition) local distance = (targetPosition - originalPosition).Magnitude local teleportDuration = distance / TELEPORT_SPEED print("Телепортация за " .. weaponName .. "...") print("Дистанция: " .. math.floor(distance) .. " studs") print("Время телепортации: " .. string.format("%.3f", teleportDuration) .. " сек") smoothTeleport(targetCFrame, teleportDuration) local waitTime = 0 while isTeleporting and waitTime < 5 do wait(0.1) waitTime = waitTime + 0.1 if not isCharacterValid() then print("Персонаж умер во время телепортации") return end end wait(RETURN_DELAY) if isCharacterValid() and weaponData.model and weaponData.model:FindFirstChild("Handle") then local handle = weaponData.model.Handle if handle and (handle.Position - humanoidRootPart.Position).Magnitude <= PICKUP_RANGE then firetouchinterest(humanoidRootPart, handle, 0) wait(0.1) firetouchinterest(humanoidRootPart, handle, 1) print(weaponName .. " подобран!") end end if not isCharacterValid() then print("Персонаж умер, отмена возврата") return end print("Возврат на исходную позицию...") local returnDuration = distance / TELEPORT_SPEED smoothTeleport(originalCFrame, returnDuration) print("Телепортация завершена!") end local function createUI() if screenGui then screenGui:Destroy() end screenGui = Instance.new("ScreenGui") screenGui.Name = "WeaponTeleporterUI" screenGui.Parent = player:WaitForChild("PlayerGui") screenGui.ResetOnSpawn = false -- Важно! Не сбрасывать GUI при возрождении frame = Instance.new("Frame") frame.Size = UDim2.new(0, 200, 0, 120) frame.Position = UDim2.new(0, 10, 0, 10) frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40) frame.BorderSizePixel = 2 frame.BorderColor3 = Color3.fromRGB(100, 100, 100) frame.Visible = isUIVisible frame.Active = true frame.Selectable = true frame.Draggable = true frame.Parent = screenGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = frame local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 30) title.Position = UDim2.new(0, 0, 0, 0) title.BackgroundColor3 = Color3.fromRGB(30, 30, 30) title.Text = "Weapon Teleporter" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.SourceSansBold title.TextSize = 18 title.Parent = frame local titleCorner = Instance.new("UICorner") titleCorner.CornerRadius = UDim.new(0, 8) titleCorner.Parent = title m4Button = Instance.new("TextButton") m4Button.Size = UDim2.new(0.9, 0, 0, 30) m4Button.Position = UDim2.new(0.05, 0, 0, 40) m4Button.BackgroundColor3 = Color3.fromRGB(60, 60, 200) m4Button.TextColor3 = Color3.fromRGB(255, 255, 255) m4Button.Text = "Get M4A1" m4Button.Font = Enum.Font.SourceSansBold m4Button.TextSize = 16 m4Button.Parent = frame local m4Corner = Instance.new("UICorner") m4Corner.CornerRadius = UDim.new(0, 6) m4Corner.Parent = m4Button m4Button.MouseButton1Click:Connect(function() teleportForWeapon("M4A1") end) m4Button.MouseEnter:Connect(function() m4Button.BackgroundColor3 = Color3.fromRGB(80, 80, 220) end) m4Button.MouseLeave:Connect(function() m4Button.BackgroundColor3 = Color3.fromRGB(60, 60, 200) end) remButton = Instance.new("TextButton") remButton.Size = UDim2.new(0.9, 0, 0, 30) remButton.Position = UDim2.new(0.05, 0, 0, 80) remButton.BackgroundColor3 = Color3.fromRGB(200, 60, 60) remButton.TextColor3 = Color3.fromRGB(255, 255, 255) remButton.Text = "Get Remington 870" remButton.Font = Enum.Font.SourceSansBold remButton.TextSize = 16 remButton.Parent = frame local remCorner = Instance.new("UICorner") remCorner.CornerRadius = UDim.new(0, 6) remCorner.Parent = remButton remButton.MouseButton1Click:Connect(function() teleportForWeapon("Remington870") end) remButton.MouseEnter:Connect(function() remButton.BackgroundColor3 = Color3.fromRGB(220, 80, 80) end) remButton.MouseLeave:Connect(function() remButton.BackgroundColor3 = Color3.fromRGB(200, 60, 60) end) local closeButton = Instance.new("TextButton") closeButton.Size = UDim2.new(0, 25, 0, 25) closeButton.Position = UDim2.new(1, -30, 0, 5) closeButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60) closeButton.TextColor3 = Color3.fromRGB(255, 255, 255) closeButton.Text = "X" closeButton.Font = Enum.Font.SourceSansBold closeButton.TextSize = 16 closeButton.Parent = frame local closeCorner = Instance.new("UICorner") closeCorner.CornerRadius = UDim.new(0, 12) closeCorner.Parent = closeButton closeButton.MouseButton1Click:Connect(function() toggleUI() end) local infoLabel = Instance.new("TextLabel") infoLabel.Size = UDim2.new(1, -10, 0, 20) infoLabel.Position = UDim2.new(0, 5, 0, 115) infoLabel.BackgroundTransparency = 1 infoLabel.TextColor3 = Color3.fromRGB(200, 200, 200) infoLabel.Text = "Drag to move | Shift to hide" infoLabel.Font = Enum.Font.SourceSans infoLabel.TextSize = 12 infoLabel.TextXAlignment = Enum.TextXAlignment.Left infoLabel.Parent = frame toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(0, 120, 0, 30) toggleButton.Position = UDim2.new(0.5, -60, 0, 150) toggleButton.BackgroundColor3 = Color3.fromRGB(60, 150, 60) toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) toggleButton.Text = "Show UI (Shift)" toggleButton.Font = Enum.Font.SourceSansBold toggleButton.TextSize = 14 toggleButton.Visible = not isUIVisible toggleButton.Parent = screenGui local toggleCorner = Instance.new("UICorner") toggleCorner.CornerRadius = UDim.new(0, 6) toggleCorner.Parent = toggleButton toggleButton.MouseButton1Click:Connect(function() toggleUI() end) end local function toggleUI() isUIVisible = not isUIVisible if frame then frame.Visible = isUIVisible end if toggleButton then toggleButton.Visible = not isUIVisible toggleButton.Text = isUIVisible and "Hide UI (Shift)" or "Show UI (Shift)" end end createUI() player.CharacterAdded:Connect(function() wait(1) if not screenGui or not screenGui.Parent then createUI() end end) UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.F1 then teleportForWeapon("M4A1") elseif input.KeyCode == Enum.KeyCode.F2 then teleportForWeapon("Remington870") elseif input.KeyCode == Enum.KeyCode.RightShift then toggleUI() end end) print("=== Weapon Teleporter Loaded ===") print("Features:") print("- Auto-reconnect on respawn") print("- Character health checks") print("- UI persistence") print("Controls:") print("1. F1 - Get M4A1") print("2. F2 - Get Remington 870") print("3. Right Shift - Toggle UI") print("4. Drag window to move") print("=================================") game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", { Text = "[Weapon Teleporter v2] Loaded! Works after respawn!", Color = Color3.fromRGB(0, 200, 255), Font = Enum.Font.SourceSansBold, FontSize = Enum.FontSize.Size18 })