Advertisement
kill21_2

просто забаганый скрипт, но очень веселый

May 8th, 2025
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. local module = {}
  2.  
  3. module.spinEnabled = true -- можно менять из других скриптов
  4.  
  5. local function spinCharacter(character)
  6. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  7. local spinConnection = nil
  8.  
  9. -- Функция для обновления состояния вращения
  10. local function updateSpin()
  11. -- Если вращение активно и персонаж жив
  12. if module.spinEnabled and humanoidRootPart and humanoidRootPart.Parent then
  13. -- Удаляем старое соединение (если есть)
  14. if spinConnection then
  15. spinConnection:Disconnect()
  16. end
  17. -- Запускаем новое вращение
  18. spinConnection = game:GetService("RunService").Heartbeat:Connect(function(deltaTime)
  19. humanoidRootPart.Orientation += Vector3.new(0, 300 * deltaTime, 0) -- 300° в секунду
  20. end)
  21. else
  22. -- Если вращение выключено, останавливаем
  23. if spinConnection then
  24. spinConnection:Disconnect()
  25. spinConnection = nil
  26. end
  27. end
  28. end
  29.  
  30. -- Следим за изменениями spinEnabled
  31. local enabledChangedConnection
  32. enabledChangedConnection = game:GetService("RunService").Heartbeat:Connect(function()
  33. updateSpin()
  34. end)
  35.  
  36. -- Останавливаем всё при смерти персонажа
  37. character:WaitForChild("Humanoid").Died:Connect(function()
  38. if spinConnection then spinConnection:Disconnect() end
  39. if enabledChangedConnection then enabledChangedConnection:Disconnect() end
  40. end)
  41. end
  42.  
  43. -- Подключение игроков
  44. game.Players.PlayerAdded:Connect(function(player)
  45. player.CharacterAdded:Connect(spinCharacter)
  46. end)
  47.  
  48. -- Для уже существующих игроков
  49. for _, player in ipairs(game.Players:GetPlayers()) do
  50. if player.Character then
  51. task.spawn(spinCharacter, player.Character)
  52. end
  53. end
  54.  
  55. return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement