Advertisement
kill21_2

скопировать на тутор

May 14th, 2025
1,271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. -- LocalScript (должен быть в StarterPlayerScripts или подобном месте)
  2. local link = "https://youtu.be/lm4HAofiSjw"
  3.  
  4. -- Проверка платформы (копирование работает только на ПК)
  5. if not (game:GetService("UserInputService"):GetPlatform() == Enum.Platform.Windows) then
  6. warn("Скрипт работает только на ПК (Windows)")
  7. return
  8. end
  9.  
  10. -- Функция для копирования текста в буфер обмена
  11. local function copyToClipboard(text)
  12. local success, errorMsg = pcall(function()
  13. -- Попытка использовать setclipboard() (если доступно)
  14. if setclipboard then
  15. setclipboard(text)
  16. print("Ссылка скопирована (через setclipboard): " .. text)
  17. return
  18. end
  19.  
  20. -- Попытка через TextService (актуально для новых версий Roblox)
  21. local textService = game:GetService("TextService")
  22. if textService.SetClipboard then
  23. textService:SetClipboard(text)
  24. print("Ссылка скопирована (через TextService): " .. text)
  25. return
  26. end
  27.  
  28. warn("Не удалось скопировать: нет доступа к буферу обмена")
  29. end)
  30.  
  31. if not success then
  32. warn("Ошибка при копировании: " .. tostring(errorMsg))
  33. end
  34. end
  35.  
  36. -- Копируем ссылку при запуске
  37. copyToClipboard(link)
  38.  
  39. -- Уведомление для игрока
  40. game:GetService("StarterGui"):SetCore("SendNotification", {
  41. Title = "Ссылка скопирована",
  42. Text = "Ссылка " .. link .. " скопирована в буфер обмена",
  43. Duration = 5
  44. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement