--[[ TELEKINES v10.1 - HYBRID MODE Клиент: движение объектов (локально) Сервер: синхронизация и валидация (через Remote) ]] local success, err = pcall(function() local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local plr = Players.LocalPlayer local chr = plr.Character or plr.CharacterAdded:Wait() local hrp = chr:FindFirstChild("HumanoidRootPart") local cam = workspace.CurrentCamera local mouse = plr:GetMouse() print("✅ Setup complete") -- === REMOTE === local Communication = game:GetService("ReplicatedStorage"):WaitForChild("Communication") print("✅ Communication Remote найден") -- === CONFIG === local config = { maxObjects = 20, distance = 20, maxDistance = 3000, strength = 100000, throwForce = 300, minSafeDistance = 10 } local state = { heldObjects = {}, currentDistance = config.distance } -- === GUI === local gui = Instance.new("ScreenGui") gui.Name = "TelekinesisGUI" gui.ResetOnSpawn = false gui.Parent = plr:WaitForChild("PlayerGui") local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 320, 0, 300) mainFrame.Position = UDim2.new(0.01, 0, 0.2, 0) mainFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 10) mainFrame.BorderSizePixel = 0 mainFrame.Parent = gui local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, 0, 0, 50) titleLabel.BackgroundColor3 = Color3.fromRGB(0, 255, 170) titleLabel.Text = "⚡ ТЕЛЕКИНЕЗ v10.1 ⚡" titleLabel.TextColor3 = Color3.fromRGB(0, 0, 0) titleLabel.Font = Enum.Font.GothamBold titleLabel.TextSize = 18 titleLabel.Parent = mainFrame local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(0.9, 0, 0, 30) statusLabel.Position = UDim2.new(0.05, 0, 0, 55) statusLabel.BackgroundTransparency = 1 statusLabel.Text = "🟢 HYBRID MODE (локальная физика)" statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100) statusLabel.Font = Enum.Font.GothamBold statusLabel.TextSize = 12 statusLabel.TextXAlignment = Enum.TextXAlignment.Left statusLabel.Parent = mainFrame local objectsLabel = Instance.new("TextLabel") objectsLabel.Size = UDim2.new(0.9, 0, 0, 25) objectsLabel.Position = UDim2.new(0.05, 0, 0, 88) objectsLabel.BackgroundTransparency = 1 objectsLabel.Text = "📦 Объектов: 0/" .. config.maxObjects objectsLabel.TextColor3 = Color3.fromRGB(200, 200, 200) objectsLabel.Font = Enum.Font.Gotham objectsLabel.TextSize = 12 objectsLabel.TextXAlignment = Enum.TextXAlignment.Left objectsLabel.Parent = mainFrame local distanceLabel = Instance.new("TextLabel") distanceLabel.Size = UDim2.new(0.9, 0, 0, 25) distanceLabel.Position = UDim2.new(0.05, 0, 0, 116) distanceLabel.BackgroundTransparency = 1 distanceLabel.Text = "📏 Дистанция: " .. state.currentDistance distanceLabel.TextColor3 = Color3.fromRGB(200, 200, 200) distanceLabel.Font = Enum.Font.Gotham distanceLabel.TextSize = 12 distanceLabel.TextXAlignment = Enum.TextXAlignment.Left distanceLabel.Parent = mainFrame local helpLabel = Instance.new("TextLabel") helpLabel.Size = UDim2.new(0.9, 0, 0, 120) helpLabel.Position = UDim2.new(0.05, 0, 0, 144) helpLabel.BackgroundTransparency = 1 helpLabel.Text = [[ 🖱️ ЛКМ - захватить объект 🖱️ ПКМ - бросить последний ⌨️ E - бросить все ⌨️ G - отпустить все ⌨️ Q/R - дистанция ⌨️ ДВИЖЕНИЕ МЫШИ - объекты движутся!]] helpLabel.TextColor3 = Color3.fromRGB(150, 150, 150) helpLabel.Font = Enum.Font.Code helpLabel.TextSize = 10 helpLabel.TextXAlignment = Enum.TextXAlignment.Left helpLabel.TextYAlignment = Enum.TextYAlignment.Top helpLabel.Parent = mainFrame print("✅ GUI created") -- === CORE FUNCTIONS === local function updateUI() objectsLabel.Text = "📦 Объектов: " .. #state.heldObjects .. "/" .. config.maxObjects distanceLabel.Text = "📏 Дистанция: " .. math.floor(state.currentDistance) end -- Отправляем на сервер (синхронизация) local function sendToServer(action, data) pcall(function() Communication:FireServer({ action = action, data = data, timestamp = tick() }) end) end -- RELEASE OBJECT local function releaseObject(objIndex, shouldThrow) if not objIndex or not state.heldObjects[objIndex] then return end local objData = state.heldObjects[objIndex] if shouldThrow and objData.part and objData.part.Parent then local direction = (mouse.Hit.p - cam.CFrame.Position).Unit objData.part.Velocity = direction * config.throwForce -- Отправляем на сервер sendToServer("throw", { part = objData.part, direction = direction, force = config.throwForce }) statusLabel.Text = "💥 БРОСОК!" end -- Очистка pcall(function() if objData.constraint then objData.constraint:Destroy() end end) pcall(function() if objData.a0 then objData.a0:Destroy() end end) pcall(function() if objData.a1 then objData.a1:Destroy() end end) pcall(function() if objData.holder then objData.holder:Destroy() end end) table.remove(state.heldObjects, objIndex) updateUI() -- Отправляем на сервер об отпускании sendToServer("release", { partName = objData.part and objData.part.Name or "unknown" }) end -- GRAB OBJECT - ВСЕ ЛОКАЛЬНО! local function grabObject(obj) if not obj then return false end if obj:IsDescendantOf(chr) then return false end if #state.heldObjects >= config.maxObjects then statusLabel.Text = "⚠️ Макс объектов!" return false end local distToObj = (obj.Position - cam.CFrame.Position).Magnitude if distToObj > config.maxDistance then return false end if obj.Anchored then return false end for _, objData in ipairs(state.heldObjects) do if objData.part == obj then return false end end -- === ЛОКАЛЬНОЕ СОЗДАНИЕ CONSTRAINT'ОВ === -- Создаём holder local holder = Instance.new("Part") holder.Name = "TKHolder_" .. obj.Name holder.Size = Vector3.new(0.05, 0.05, 0.05) holder.Transparency = 1 holder.CanCollide = false holder.CanTouch = false holder.CanQuery = false holder.Anchored = true holder.Parent = workspace -- Attachments local a0 = Instance.new("Attachment", obj) local a1 = Instance.new("Attachment", holder) -- AlignPosition (ЛОКАЛЬНО) local alignPos = Instance.new("AlignPosition") alignPos.Attachment0 = a0 alignPos.Attachment1 = a1 alignPos.MaxForce = config.strength alignPos.MaxVelocity = math.huge alignPos.Responsiveness = 120 alignPos.RigidityEnabled = false alignPos.ApplyAtCenterOfMass = true alignPos.ReactionForceEnabled = false alignPos.Parent = obj -- Сохраняем данные объекта table.insert(state.heldObjects, { part = obj, holder = holder, constraint = alignPos, a0 = a0, a1 = a1 }) statusLabel.Text = "✅ Захвачено: " .. obj.Name updateUI() -- Отправляем на сервер об захвате sendToServer("grab", { partName = obj.Name, position = obj.Position }) print("✅ Объект захвачен и готов к движению") return true end -- THROW ALL local function throwAllObjects() for i = #state.heldObjects, 1, -1 do releaseObject(i, true) end statusLabel.Text = "💥💥💥 БРОСИЛИ ВСЕ!" end -- RELEASE ALL local function releaseAllObjects() for i = #state.heldObjects, 1, -1 do releaseObject(i, false) end statusLabel.Text = "✋ ОТПУСТИЛИ ВСЕ" end print("✅ Functions defined") -- === INPUT === -- ЛКМ mouse.Button1Down:Connect(function() if mouse.Target then grabObject(mouse.Target) end end) -- ПКМ mouse.Button2Down:Connect(function() if #state.heldObjects > 0 then releaseObject(#state.heldObjects, true) end end) -- Keyboard UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.E then throwAllObjects() elseif input.KeyCode == Enum.KeyCode.G then releaseAllObjects() elseif input.KeyCode == Enum.KeyCode.Q then state.currentDistance = math.max(state.currentDistance - 5, config.minSafeDistance) updateUI() elseif input.KeyCode == Enum.KeyCode.R then state.currentDistance = math.min(state.currentDistance + 5, config.maxDistance) updateUI() elseif input.KeyCode == Enum.KeyCode.H then print("\n" .. string.rep("=", 60)) print("ТЕЛЕКИНЕЗ v10.1 - СПРАВКА") print("=" .. string.rep("=", 60)) print("РЕЖИМ: HYBRID (клиент + сервер)") print(" - Клиент управляет AlignPosition'ом (движение ЛОКАЛЬНО)") print(" - Сервер синхронизирует для других игроков") print("\nУПРАВЛЕНИЕ:") print(" ЛКМ - захватить | ПКМ - бросить последний") print(" E - все броски | G - отпустить все") print(" Q/R - дистанция | H - справка") print("=" .. string.rep("=", 60) .. "\n") end end) print("✅ Input handlers connected") -- === MAIN LOOP - ЛОКАЛЬНОЕ ДВИЖЕНИЕ HOLDER'ОВ === RunService.Heartbeat:Connect(function() if #state.heldObjects == 0 then return end for i, objData in ipairs(state.heldObjects) do if objData.part and objData.part.Parent and objData.holder then -- КЛЮЧЕВАЯ ЧАСТЬ - обновляем позицию holder'а ЛОКАЛЬНО local mouseDirection = (mouse.Hit.p - cam.CFrame.Position).Unit local targetPos = cam.CFrame.Position + mouseDirection * state.currentDistance -- Защита от врезания local distToPlayer = (targetPos - hrp.Position).Magnitude if distToPlayer < config.minSafeDistance then local dirFromPlayer = (targetPos - hrp.Position).Unit targetPos = hrp.Position + dirFromPlayer * config.minSafeDistance end -- ОБНОВЛЯЕМ ПОЗИЦИЮ HOLDER'А (это включит AlignPosition) objData.holder.CFrame = CFrame.new(targetPos) else releaseObject(i, false) end end end) print("✅ Main loop (локальное движение) активирован") -- === CHARACTER HANDLERS === chr.Humanoid.Died:Connect(function() releaseAllObjects() sendToServer("player_died", {}) end) plr.CharacterAdded:Connect(function(newChr) chr = newChr hrp = chr:WaitForChild("HumanoidRootPart") releaseAllObjects() end) print("✅ Character handlers connected") end) -- === ERROR HANDLING === if not success then warn("❌ ОШИБКА: " .. err) else print("\n" .. string.rep("=", 70)) print("✅ ✅ ✅ ТЕЛЕКИНЕЗ v10.1 HYBRID MODE LOADED ✅ ✅ ✅") print("=" .. string.rep("=", 70)) print("\n🎮 РЕЖИМ: ГИБРИДНЫЙ") print("✅ Клиент: управление физикой (локальное движение)") print("✅ Сервер: синхронизация (через Remote)") print("\n📍 GUI видна в левом углу") print("🎯 Объекты должны ПЛАВНО движться за мышью!") print("=" .. string.rep("=", 70) .. "\n") end