Advertisement
2AreYouMental110

hat universe spin

Mar 18th, 2021
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- original https://www.youtube.com/watch?v=-xbnryPmzQk
  2.  
  3. local plr = game.Players.LocalPlayer;
  4. local chr = plr.Character;
  5. local hum = chr.Humanoid;
  6. local mov = {};
  7. local mov2 = {};
  8.  
  9. --[[Network]]
  10. coroutine.resume(coroutine.create(function()
  11.     settings().Physics.AllowSleep = false;
  12.     game.RunService.RenderStepped:Connect(function()
  13.         for i, v in pairs(game.Players:GetPlayers()) do
  14.             if v ~= plr then
  15.                 v.MaximumSimulationRadius = 0.1;
  16.                 v.SimulationRadius = 0;
  17.             else
  18.                 v.MaximumSimulationRadius = math.pow(math.huge, math.huge);
  19.                 v.SimulationRadius = math.pow(math.huge, 2);
  20.             end
  21.         end
  22.     end)
  23. end))
  24.  
  25. function ftp(str)
  26.     local pt = {};
  27.     if str ~= 'me' and str ~= 'random' then
  28.         for i, v in pairs(game.Players:GetPlayers()) do
  29.             if v.Name:lower():find(str:lower()) then
  30.                 table.insert(pt, v);
  31.             end
  32.         end
  33.     elseif str == 'me' then
  34.         table.insert(pt, plr);
  35.     elseif str == 'random' then
  36.         table.insert(pt, game.Players:GetPlayers()[math.random(1, #game.Players:GetPlayers())]);
  37.     end
  38.     return pt;
  39. end
  40.  
  41. for _, v in pairs(hum:GetAccessories()) do
  42.     local b = v.Handle;
  43.     b.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0);
  44.     b.CanCollide = false;
  45.     b:BreakJoints();
  46.     for _, k in pairs(v:GetChildren()) do
  47.         if not k:IsA'SpecialMesh' and not k:IsA'Part' then
  48.             k:Destroy();
  49.         end
  50.     end
  51.     local still = Instance.new('BodyAngularVelocity', b);
  52.     still.MaxTorque = Vector3.new(math.huge, math.huge, math.huge);
  53.     still.AngularVelocity = Vector3.new(0, 0, 0);
  54.     local align = Instance.new('AlignPosition', b);
  55.     align.MaxForce = 1000000;
  56.     align.MaxVelocity = math.huge;
  57.     align.RigidityEnabled = false;
  58.     align.ApplyAtCenterOfMass = true;
  59.     align.Responsiveness = 200;
  60.     local a0 = Instance.new('Attachment', b);
  61.     local a1 = Instance.new('Attachment', chr.Head);
  62.     align.Attachment0 = a0;
  63.     align.Attachment1 = a1;
  64.     table.insert(mov, a1);
  65.     table.insert(mov2, still);
  66. end
  67.  
  68. local par = {};
  69. for _, v in pairs(mov) do
  70.     local parr = Instance.new('Part', workspace);
  71.     parr.Anchored = true;
  72.     parr.Size = Vector3.new(1, 1, 1);
  73.     parr.Transparency = 1;
  74.     parr.CanCollide = false;
  75.     table.insert(par, parr);
  76. end
  77.  
  78. local rotx = 0;
  79. local rotz = math.pi / 2;
  80. local height = 0;
  81. local heighti = 1;
  82. local offset = 10;
  83. local speed = 0.5; -- set how fast the hats spin
  84. local mode = 4;
  85. local angular = Vector3.new(0, 0, 0);
  86. local l = 1;
  87. game['Run Service'].RenderStepped:Connect(function()
  88.     rotx = rotx + speed / 100;
  89.     rotz = rotz + speed / 100;
  90.     l = (l >= 360 and 1 or l + speed);
  91.    
  92.     for i, v in pairs(par) do
  93.         v.CFrame = CFrame.new(chr.HumanoidRootPart.Position) * CFrame.fromEulerAnglesXYZ(0, math.rad(l + (360 / #par) * i + speed), 0) * CFrame.new(offset, 0, 0);
  94.     end
  95.    
  96.     if heighti == 1 then
  97.         height = height + speed / 100;
  98.     elseif heighti == 2 then
  99.         height = height - speed / 100;
  100.     end
  101.     if height > 2 then
  102.         heighti = 2;
  103.     end
  104.     if height < -1 then
  105.         heighti = 1;
  106.     end
  107.    
  108.     if mode == 1 then
  109.         for _, v in pairs(mov) do
  110.             v.Position = Vector3.new(math.sin(rotx) * offset, 0, math.sin(rotz) * offset);
  111.         end
  112.     elseif mode == 2 then
  113.         for _, v in pairs(mov) do
  114.             v.Position = Vector3.new(offset, height, offset);
  115.         end
  116.     elseif mode == 3 then
  117.         for _, v in pairs(mov) do
  118.             v.Position = Vector3.new(math.sin(rotx) * offset, height, math.sin(rotz) * offset);
  119.         end
  120.     elseif mode == 4 then
  121.         for i, v in pairs(mov) do
  122.             v.Position = Vector3.new(chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).X, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Y, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Z);
  123.         end
  124.     elseif mode == 5 then
  125.         for i, v in pairs(mov) do
  126.             v.Position = Vector3.new((math.sin(rotx)) * offset, height, (math.cos(rotz) - i) * offset);
  127.         end
  128.     elseif mode == 6 then
  129.         for i, v in pairs(mov) do
  130.             v.Position = Vector3.new((math.sin(rotx)) * offset, height, (math.tan(rotz) - i) * offset);
  131.         end
  132.     elseif mode == 7 then
  133.         for i, v in pairs(mov) do
  134.             v.Position = Vector3.new(math.cos(rotx * i) * offset, 0, math.cos(rotz * i) * offset);
  135.         end
  136.     elseif mode == 8 then
  137.         for i, v in pairs(mov) do
  138.             v.Position = Vector3.new(math.sin(rotx) * i * offset, 0, math.sin(rotz) * i * offset);
  139.         end
  140.     elseif mode == 9 then
  141.         pcall(function()
  142.             local so = nil;
  143.             for k, b in pairs(chr:GetChildren()) do
  144.                 if b:IsA'Tool' then
  145.                     for h, j in pairs(b:GetDescendants()) do
  146.                         if j:IsA'Sound' then
  147.                             so = j;
  148.                         end
  149.                     end
  150.                 end
  151.             end
  152.             if so ~= nil then
  153.                 offset = so.PlaybackLoudness / 35;
  154.                 speed = so.PlaybackLoudness / 500;
  155.                 angular = Vector3.new(0, so.PlaybackLoudness / 75, 0);
  156.             end
  157.         end)
  158.         for i, v in pairs(mov) do
  159.             v.Position = Vector3.new(chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).X, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Y, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Z);
  160.         end
  161.     elseif mode == 10 then
  162.         offset = height * 15;
  163.         for i, v in pairs(mov) do
  164.             v.Position = Vector3.new(chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).X, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Y, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Z);
  165.         end
  166.     elseif mode == 11 then
  167.         for i, v in pairs(mov) do
  168.             v.Position = Vector3.new(chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(plr:GetMouse().Hit.p)).X, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(plr:GetMouse().Hit.p)).Y, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(plr:GetMouse().Hit.p)).Z) + Vector3.new(chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).X, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Y, chr.HumanoidRootPart.CFrame:ToObjectSpace(CFrame.new(par[i].Position)).Z);
  169.         end
  170.     end
  171.     for _, v in pairs(mov2) do
  172.         v.AngularVelocity = angular;
  173.     end
  174. end)
  175. game.Players.LocalPlayer.Chatted:Connect(function(c)
  176.     if c:split(' ')[1] == '.orbit' then
  177.         for _, v in pairs(mov) do
  178.             chr = ftp(c:split(' ')[2])[1].Character;
  179.             v.Parent = ftp(c:split(' ')[2])[1].Character.HumanoidRootPart;
  180.         end
  181.     end
  182.     if c:split(' ')[1] == '.speed' then
  183.         speed = tonumber(c:split(' ')[2]);
  184.     end
  185.     if c:split(' ')[1] == '.mode' then
  186.         mode = tonumber(c:split(' ')[2]);
  187.     end
  188.     if c:split(' ')[1] == '.offset' then
  189.         offset = tonumber(c:split(' ')[2]);
  190.     end
  191.     if c:split(' ')[1] == '.angular' then
  192.         angular = Vector3.new(tonumber(c:split(' ')[2]), tonumber(c:split(' ')[3]), tonumber(c:split(' ')[4]));
  193.     end
  194. end)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement