Advertisement
HackMan128

TORNADO rbx

Apr 13th, 2025 (edited)
286
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.50 KB | None | 0 1
  1. ---████████--██████  ██████  ███    ██  █████  ██████   ██████  
  2. ------██  --██    ██ ██   ██ ████   ██ ██   ██ ██   ██ ██    ██
  3. ------██  --██ ██ ██ ██████  ██ ██  ██ ███████ ██   ██ ██    ██
  4. ------██  --██    ██ ██   ██ ██  ██ ██ ██   ██ ██   ██ ██    ██ a modified version of Super Ring
  5. ------██   --██████  ██   ██ ██   ████ ██   ██ ██████   ██████  v.1 by TC123
  6.                                      
  7.                 -- 'P' to activate/deactivate  
  8.                
  9. local Players = game:GetService("Players")
  10. local RunService = game:GetService("RunService")
  11. local UserInputService = game:GetService("UserInputService")
  12. local SoundService = game:GetService("SoundService")
  13. local StarterGui = game:GetService("StarterGui")
  14. local TextChatService = game:GetService("TextChatService")
  15.  
  16. local LocalPlayer = Players.LocalPlayer
  17.  
  18. -- Sound Effects
  19. local function playSound(soundId)
  20.     local sound = Instance.new("Sound")
  21.     sound.SoundId = "rbxassetid://" .. soundId
  22.     sound.Parent = SoundService
  23.     sound:Play()
  24.     sound.Ended:Connect(function()
  25.         sound:Destroy()
  26.     end)
  27. end
  28.  
  29. -- Play initial sound
  30. playSound("2865227271")
  31.  
  32.  
  33.  
  34. -- Ring Parts Logic
  35. if not getgenv().Network then
  36.     getgenv().Network = {
  37.         BaseParts = {},
  38.         Velocity = Vector3.new(14.46262424, 14.46262424, 14.46262424)
  39.     }
  40.     Network.RetainPart = function(Part)
  41.         if Part:IsDescendantOf(workspace) then
  42.             table.insert(Network.BaseParts, Part)
  43.             Part.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
  44.             Part.CanCollideCanCollide = false
  45.         end
  46.     end
  47.     local function EnablePartControl()
  48.         LocalPlayer.ReplicationFocus = workspace
  49.         RunService.Heartbeat:Connect(function()
  50.             sethiddenproperty(LocalPlayer, "SimulationRadius", math.huge)
  51.             for index, part in ipairs(Network.BaseParts) do
  52.                 if Part:IsDescendantOf(workspace) then
  53.                     Part.Velocity = Network.Velocity
  54.                 end
  55.             end
  56.         end)
  57.     end
  58.     EnablePartControl()
  59. end
  60.  
  61. local radius = 10
  62. local height = 100
  63. local rotationSpeed = 0.05
  64. local attractionStrength = 100
  65. local ringPartsEnabled = false
  66.  
  67. local function RetainPart(Part)
  68.     if Part:IsA("BasePart") and not Part.Anchored and Part:IsDescendantOf(workspace) then
  69.         if Part.Parent == LocalPlayer.Character or Part:IsDescendantOf(LocalPlayer.Character) then
  70.             return false
  71.         end
  72.  
  73.         Part.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
  74.         Part.CanCollide = false
  75.         return true
  76.     end
  77.     return false
  78. end
  79.  
  80. local parts = {}
  81. local function addPart(part)
  82.     if RetainPart(part) then
  83.         --if not table.find(parts, part) then
  84.             table.insert(parts, part)
  85.         --end
  86.     end
  87. end
  88.  
  89. local function removePart(part)
  90.     local index = table.find(parts, part)
  91.     if index then
  92.         table.remove(parts, index)
  93.     end
  94. end
  95.  
  96. for index, part in ipairs(workspace:GetDescendants()) do
  97.     addPart(part)
  98. end
  99.  
  100. workspace.DescendantAdded:Connect(addPart)
  101. workspace.DescendantRemoving:Connect(removePart)
  102.  
  103.  
  104. RunService.Heartbeat:Connect(function()
  105.     if not ringPartsEnabled then return end
  106.     local counter = 0
  107.  
  108.     local humanoidRootPart = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
  109.     humanoidRootPart.CFrame = humanoidRootPart.CFrame * CFrame.Angles(0, math.rad(-36.0), 0)
  110.    
  111.     if humanoidRootPart then
  112.         local tornadoCenter = humanoidRootPart.Position
  113.         for index, part in ipairs(parts) do
  114.             if part.Parent and not part.Anchored then
  115.                 local ms = tick()
  116.                 local pos = part.Position
  117.                 local distance = (Vector3.new(pos.X, tornadoCenter.Y, pos.Z) - tornadoCenter).Magnitude
  118.                 local angle = math.atan2(pos.Z - tornadoCenter.Z, pos.X - tornadoCenter.X)
  119.                 local newAngle = angle + math.rad(rotationSpeed)
  120.    
  121.                 local newHeight = (index % 2)*(0.01 + (math.cos(ms*3+newAngle*1))*0.005+(math.sin(ms*3+newAngle*1))*0.005)
  122.                 local newHeightOdd = (1.1+ (index % 2))*(0.01 + (math.cos(ms*2+newAngle*1))*0.005+(math.sin(ms*2+newAngle*1))*-0.005)
  123.                 local targetPos = Vector3.new(
  124.                     tornadoCenter.X + math.cos(newAngle) * math.min(radius+newHeightOdd, distance),
  125.                     tornadoCenter.Y + (height * (math.abs(math.sin((pos.Y - tornadoCenter.Y) / height)))) + newHeight+newHeightOdd,
  126.                     tornadoCenter.Z + math.sin(newAngle) * math.min(radius+newHeightOdd, distance)
  127.                 )
  128.                
  129.                 -- game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.Angles(0, math.rad(-0.7), 0)
  130.  
  131.                 local directionToTarget = (targetPos - part.Position).unit
  132.                 part.Velocity = directionToTarget * attractionStrength
  133.             end
  134.         end
  135.     end
  136. end)
  137.  
  138. -- Toggle ringPartsEnabled on keypress "P"
  139. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  140.     if gameProcessed then return end
  141.     if input.KeyCode == Enum.KeyCode.P then
  142.         ringPartsEnabled = not ringPartsEnabled
  143.     end
  144. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement