ViggoCS

Red_Fidget_Spinner

Aug 12th, 2017
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.65 KB | None | 0 0
  1. --Converted by N3xul.
  2. -- _ _ ____ _ _____ _ _
  3. -- | \ | |___ \ | | / ____| (_) | |
  4. -- | \| | __) |_ ___ _| | | (___ ___ _ __ _ _ __ | |_
  5. -- | . ` ||__ <\ \/ / | | | | \___ \ / __| '__| | '_ \| __|
  6. -- | |\ |___) |> <| |_| | | ____) | (__| | | | |_) | |_
  7. -- |_| \_|____//_/\_\\__,_|_| |_____/ \___|_| |_| .__/ \__|
  8. -- | |
  9. -- |_|
  10. local runDummyScript = function(f,scri)
  11. local oldenv = getfenv(f)
  12. local newenv = setmetatable({}, {
  13. __index = function(_, k)
  14. if k:lower() == 'script' then
  15. return scri
  16. else
  17. return oldenv[k]
  18. end
  19. end
  20. })
  21. setfenv(f, newenv)
  22. ypcall(function() f() end)
  23. end
  24. cors = {}
  25. mas = Instance.new("Model",game:GetService("Lighting"))
  26. mas.Name = "CompiledModel"
  27. o1 = Instance.new("Tool")
  28. o2 = Instance.new("Part")
  29. o3 = Instance.new("SpecialMesh")
  30. o5 = Instance.new("Attachment")
  31. o6 = Instance.new("Script")
  32. o7 = Instance.new("LocalScript")
  33. o1.Name = "RedFidgetSpinner"
  34. o1.Parent = mas
  35. o1.TextureId = "rbxassetid://915250372"
  36. o1.GripForward = Vector3.new(-0, 1, -0)
  37. o1.GripUp = Vector3.new(0, 0, 1)
  38. o2.Name = "Handle"
  39. o2.Parent = o1
  40. o2.Position = Vector3.new(41.1632881, 0.100239001, 57.1540794)
  41. o2.Rotation = Vector3.new(89.9700012, -0.0299999993, 36.9099998)
  42. o2.Size = Vector3.new(0.5, 0.5, 0.199999988)
  43. o2.CFrame = CFrame.new(41.1632881, 0.100239001, 57.1540794, 0.799575806, -0.600564897, -0.000564188871, -0.000188550242, 0.000688399363, -0.999999762, 0.600565135, 0.799575686, 0.000437190814)
  44. o2.Position = Vector3.new(41.1632881, 0.100239001, 57.1540794)
  45. o2.Orientation = Vector3.new(89.9599991, -52.2299995, -15.3199997)
  46. o3.Parent = o2
  47. o3.MeshId = "rbxassetid://915251142"
  48. o3.Offset = Vector3.new(-0.00999999978, 0.140000001, 0)
  49. o3.Scale = Vector3.new(0.150000006, 0.150000006, 0.150000006)
  50. o3.TextureId = "rbxassetid://915250833"
  51. o3.MeshType = Enum.MeshType.FileMesh
  52. o3.Scale = Vector3.new(0.150000006, 0.150000006, 0.150000006)
  53. o5.Name = "RightGripAttachment"
  54. o5.Parent = o2
  55. o5.Rotation = Vector3.new(90, 3.61587208e-28, -0)
  56. o5.CFrame = CFrame.new(0, 0, 0, 1, 0, 6.31088724e-30, 6.31088724e-30, 0, -1, 0, 1, 0)
  57. o5.Axis = Vector3.new(1, 6.31088724e-30, 0)
  58. o5.Orientation = Vector3.new(90, 0, 0)
  59. o6.Parent = o1
  60. table.insert(cors,coroutine.create(function()
  61. wait()
  62. runDummyScript(function()
  63. local Players = game:GetService("Players")
  64. local RunService = game:GetService("RunService")
  65.  
  66. local Tool = script.Parent
  67. local Handle = Tool.Handle
  68. if not Handle then return end
  69.  
  70. local Character = nil
  71. local RightHand = nil
  72. local SpinningConn = nil
  73.  
  74. local SPIN_SPEED = 1500
  75. local SLOW_DOWN_RATE = 50
  76. local CurrentSpeed = 0
  77.  
  78. function Spin()
  79. local RightGrip = RightHand:FindFirstChild("RightGrip")
  80. if RightGrip then
  81. CurrentSpeed = math.min(CurrentSpeed + SPIN_SPEED, 4000)
  82.  
  83. if SpinningConn then return end
  84. SpinningConn = RunService.Heartbeat:Connect(function(delta)
  85. RightGrip.C1 = RightGrip.C1 * CFrame.Angles(0, math.rad(-1) * delta * CurrentSpeed, 0)
  86. CurrentSpeed = math.max(0, CurrentSpeed - (SLOW_DOWN_RATE * delta))
  87. if CurrentSpeed <= 0 then
  88. SpinningConn:Disconnect()
  89. SpinningConn = nil
  90. end
  91. end)
  92. end
  93. end
  94.  
  95. function OnActivated()
  96. if not Tool.Enabled then return end
  97. Tool.Enabled = false
  98.  
  99. Spin()
  100.  
  101. wait(1)
  102. Tool.Enabled = true
  103. end
  104.  
  105. function OnEquipped()
  106. Character = Tool.Parent
  107. RightHand = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
  108. end
  109.  
  110. function OnUnequipped()
  111. if SpinningConn then
  112. SpinningConn:Disconnect()
  113. SpinningConn = nil
  114. end
  115.  
  116. Character = nil
  117. RightHand = nil
  118. CurrentSpeed = 0
  119. end
  120.  
  121. Tool.Equipped:Connect(OnEquipped)
  122. Tool.Unequipped:Connect(OnUnequipped)
  123. Tool.Activated:Connect(OnActivated)
  124. end,o6)
  125. end))
  126. o7.Name = "MouseIcon"
  127. o7.Parent = o1
  128. table.insert(cors,coroutine.create(function()
  129. wait()
  130. runDummyScript(function()
  131. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  132. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  133.  
  134. Tool = script.Parent
  135.  
  136. Mouse = nil
  137.  
  138. function UpdateIcon()
  139. if Mouse then
  140. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  141. end
  142. end
  143.  
  144. function OnEquipped(ToolMouse)
  145. Mouse = ToolMouse
  146. UpdateIcon()
  147. end
  148.  
  149. Tool:GetPropertyChangedSignal("Enabled"):Connect(UpdateIcon)
  150. Tool.Equipped:connect(OnEquipped)
  151. end,o7)
  152. end))
  153. mas.Parent = workspace
  154. mas:MakeJoints()
  155. local mas1 = mas:GetChildren()
  156. for i=1,#mas1 do
  157. mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  158. ypcall(function() mas1[i]:MakeJoints() end)
  159. end
  160. mas:Destroy()
  161. for i=1,#cors do
  162. coroutine.resume(cors[i])
  163. end
Add Comment
Please, Sign In to add comment