XDMANFROMXDWORLD

ROBLOX Fidget Spinner Script xd

Jun 26th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.41 KB | None | 0 0
  1. ------------------
  2. --FIJJET SPINNUH--
  3. ------------------
  4. --By --
  5. --CKbackup-
  6. -----------
  7.  
  8. player = game.Players.LocalPlayer
  9. chara = player.Character
  10. debby = game.Debris
  11. Mouse = player:GetMouse()
  12. rs = game:GetService("RunService").RenderStepped
  13. speedo = 20
  14. mode = "Drop"
  15.  
  16. --Outfit--
  17. New = function(Object, Parent, Name, Data)
  18. local Object = Instance.new(Object)
  19. for Index, Value in pairs(Data or {}) do
  20. Object[Index] = Value
  21. end
  22. Object.Parent = Parent
  23. Object.Name = Name
  24. return Object
  25. end
  26.  
  27. SpinnerWeldBlock = New("Part",chara,"SpinnerWeldBlock",{Transparency = 1,Transparency = 1,Size = Vector3.new(0.600000024, 0.200000003, 0.599999964),CFrame = CFrame.new(-27.7000008, 2.10000014, 9.10000038, 1, 0, 0, 0, 1, 0, 0, 0, 1),BottomSurface = Enum.SurfaceType.Smooth,TopSurface = Enum.SurfaceType.Smooth,})
  28. Weld = New("ManualWeld",SpinnerWeldBlock,"Weld",{Part0 = SpinnerWeldBlock,Part1 = chara["Right Arm"],C1 = CFrame.new(-0.200000763, -0.899999619, -0.600000143, 1, 0, 0, 0, 0, 1, -0, -1, -0),})
  29. FIJJETSPINNUH = New("Part",chara,"FIJJETSPINNUH",{BrickColor = BrickColor.new("Bright red"),Size = Vector3.new(1.4000001, 0.200000003, 1.39999998),CFrame = CFrame.new(-27.7000008, 2.10000014, 9.10000038, 1, 0, 0, 0, 1, 0, 0, 0, 1),BottomSurface = Enum.SurfaceType.Smooth,TopSurface = Enum.SurfaceType.Smooth,Color = Color3.new(0.768628, 0.156863, 0.109804),})
  30. FidgetSpinnerMesh = New("SpecialMesh",FIJJETSPINNUH,"FidgetSpinnerMesh",{Offset = Vector3.new(0, 0, -0.135000005),Scale = Vector3.new(3.5, 6, 3.5),MeshId = "rbxassetid://785024366",MeshType = Enum.MeshType.FileMesh,})
  31. SpinnerWeightOverlay = New("Decal",FIJJETSPINNUH,"SpinnerWeightOverlay",{Face = Enum.NormalId.Top,Texture = "rbxassetid://785492382",})
  32. FIJJETSPINNUHWELD = New("ManualWeld",FIJJETSPINNUH,"FIJJETSPINNUHWELD",{Part0 = FIJJETSPINNUH,Part1 = SpinnerWeldBlock,})
  33.  
  34. ScreenGui = New("ScreenGui",player.PlayerGui,"ScreenGui",{})
  35. Frame = New("Frame",ScreenGui,"Frame",{Size = UDim2.new(0, 150, 0, 200),Position = UDim2.new(1,0,.5,0),AnchorPoint = Vector2.new(1,0)})
  36. ColourLabel = New("TextLabel",Frame,"ColourLabel",{BackgroundTransparency = 1,BorderSizePixel = 0,Size = UDim2.new(1, 0, 0.1, 0),Text = "Spinner BrickColor"})
  37. BrickColorBox = New("TextBox",Frame,"BrickColorBox",{Size = UDim2.new(0.8, 0, 0.1, 0),Position = UDim2.new(.1,0,.1,0),Text = "(BrickColor here)"})
  38. TextureBox = New("TextBox",Frame,"TextureBox",{Size = UDim2.new(0.8, 0, 0.1, 0),Position = UDim2.new(.1,0,.3,0),Text = "(Decal ID here)"})
  39. TextureLabel = New("TextLabel",Frame,"TextureLabel",{BackgroundTransparency = 1,BorderSizePixel = 0,Size = UDim2.new(1, 0, 0.1, 0),Position = UDim2.new(0,0,.2,0),Text = "Spinner Texture"})
  40. RefTraLabel = New("TextLabel",Frame,"RefTraLabel",{BackgroundTransparency = 1,BorderSizePixel = 0,Size = UDim2.new(1, 0, 0.1, 0),Position = UDim2.new(0,0,.4,0),Text = "Reflect/Transparent"})
  41. ReflectBox = New("TextBox",Frame,"ReflectBox",{Size = UDim2.new(0.4, 0, 0.1, 0),Position = UDim2.new(.1,0,.5,0),Text = "0"})
  42. TransBox = New("TextBox",Frame,"TransBox",{Size = UDim2.new(0.4, 0, 0.1, 0),Position = UDim2.new(.5,0,.5,0),Text = "0"})
  43. SpeedLabel = New("TextLabel",Frame,"SpeedLabel",{BackgroundTransparency = 1,BorderSizePixel = 0,Size = UDim2.new(1, 0, 0.1, 0),Position = UDim2.new(0,0,.6,0),Text = "Spin Speed"})
  44. SpeedBox = New("TextBox",Frame,"SpeedBox",{Size = UDim2.new(0.8, 0, 0.1, 0),Position = UDim2.new(.1,0,.7,0),Text = "20"})
  45. ModeLabel = New("TextLabel",Frame,"ModeLabel",{BackgroundTransparency = 1,BorderSizePixel = 0,Size = UDim2.new(1, 0, 0.1, 0),Position = UDim2.new(0,0,.8,0),Text = "Mode (Switch with Q or E)"})
  46. CurrentModeLabel = New("TextLabel",Frame,"CurrentModeLabel",{BackgroundTransparency = 1,BorderSizePixel = 0,Size = UDim2.new(1, 0, 0.1, 0),Position = UDim2.new(0,0,.9,0),Text = "Drop"})
  47. CloseButton = New("TextButton",ScreenGui,"CloseButton",{Size = UDim2.new(0, 50, 0, 25),Position = UDim2.new(),AnchorPoint = Vector2.new(1,1),Position = UDim2.new(1,0,.5,0),Text = "Close"})
  48.  
  49. CloseButton.MouseButton1Click:connect(function()
  50. if Frame.Visible == true then
  51. Frame.Visible = false
  52. CloseButton.Text = "Open"
  53. elseif Frame.Visible == false then
  54. Frame.Visible = true
  55. CloseButton.Text = "Close"
  56. end
  57. end)
  58.  
  59. TextureBox.Changed:connect(function()
  60. FidgetSpinnerMesh.TextureId = TextureBox.Text
  61. end)
  62.  
  63. BrickColorBox.Changed:connect(function()
  64. FIJJETSPINNUH.BrickColor = BrickColor.new(BrickColorBox.Text)
  65. FidgetSpinnerMesh.TextureId = ""
  66. end)
  67.  
  68. ReflectBox.Changed:connect(function()
  69. FIJJETSPINNUH.Reflectance = ReflectBox.Text
  70. end)
  71.  
  72. TransBox.Changed:connect(function()
  73. FIJJETSPINNUH.Transparency = TransBox.Text
  74. end)
  75.  
  76. SpeedBox.Changed:connect(function()
  77. if SpeedBox.Text ~= "" then
  78. speedo = SpeedBox.Text
  79. end
  80. end)
  81.  
  82. function CreateTrailObj(parent,color1,color2,ofsx,ofsz)
  83. local Att1 = New("Attachment",parent,"Att1",{Position = Vector3.new(ofsx,parent.Size.Y/2,ofsz)})
  84. local Att2 = New("Attachment",parent,"Att2",{Position = Vector3.new(ofsx,-(parent.Size.Y/2),ofsz)})
  85. local TEff = New("Trail",parent,"TrailEff",{Color = ColorSequence.new({ColorSequenceKeypoint.new(0,BrickColor.new(color1).Color),ColorSequenceKeypoint.new(1,BrickColor.new(color2).Color)}),Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,.5),NumberSequenceKeypoint.new(1,1)}),Attachment0 = Att1,Attachment1 = Att2,Enabled = false,Lifetime = .5,MinLength = .001})
  86. return TEff
  87. end
  88.  
  89. --Clerp Animations--
  90. TC = chara.HumanoidRootPart.RootJoint
  91. HC = chara.Torso.Neck
  92. RAC = chara.Torso["Right Shoulder"]
  93. LAC = chara.Torso["Left Shoulder"]
  94. RLC = chara.Torso["Right Hip"]
  95. LLC = chara.Torso["Left Hip"]
  96. TCF = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  97. HCF = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  98. RACF = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  99. LACF = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  100. RLCF = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  101. LLCF = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  102. RWF = CFrame.new(-1.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  103. LWF = CFrame.new(1.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  104. RLWF = CFrame.new(-.5, 2, 0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  105. LLWF = CFrame.new(.5, 2, 0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  106. RW = Instance.new("Weld",HC.Parent)
  107. RW.Part1 = HC.Parent
  108. RW.Part0 = chara["Right Arm"]
  109. RW.C0 = RWF
  110.  
  111. function clerp(a,b,c)
  112. return a:lerp(b,c)
  113. end
  114.  
  115. --TC.C0 = TCF * CFrame.fromEulerAnglesXYZ(0,0,math.rad(90))
  116. --HC.C0 = HCF * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-50))
  117. --RW.C0 = (RWF + Vector3.new(1,2,0)) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-90))
  118. --LW.C0 = LWF * CFrame.fromEulerAnglesXYZ(0,0,math.rad(2))
  119.  
  120. RW.C0 = RWF
  121.  
  122. --Idle Clerp--
  123. IRWF = (RWF - Vector3.new(-.2,-.8,-.5)) * CFrame.fromEulerAnglesXYZ(math.rad(-90),math.rad(-10),0)
  124.  
  125. function res()
  126. RW.C0 = IRWF
  127. end
  128. res()
  129.  
  130. --Mouse Functions--
  131. function onKeyDown(key)
  132. if key == "q" then
  133. mode = "Drop"
  134. CurrentModeLabel.Text = mode
  135. elseif key == "e" then
  136. mode = "Throw"
  137. CurrentModeLabel.Text = mode
  138. end
  139. end
  140. function onButton1Down()
  141. if mode == "Drop" then
  142. local spinnah = FIJJETSPINNUH:Clone()
  143. spinnah.Parent = workspace
  144. spinnah.Position = FIJJETSPINNUH.Position
  145. spinnah:BreakJoints()
  146. local spinf = Instance.new("BodyAngularVelocity",spinnah)
  147. spinf.AngularVelocity = Vector3.new(0,speedo,0)
  148. spinf.MaxTorque = Vector3.new(speedo,speedo,speedo)
  149. debby:AddItem(spinnah,60)
  150. elseif mode == "Throw" then
  151. local spinnah = FIJJETSPINNUH:Clone()
  152. spinnah.Parent = workspace
  153. spinnah.Position = FIJJETSPINNUH.Position + chara.HumanoidRootPart.CFrame.lookVector*5
  154. spinnah:BreakJoints()
  155. debby:AddItem(spinnah,60)
  156. local spinf = Instance.new("BodyAngularVelocity",spinnah)
  157. spinf.AngularVelocity = Vector3.new(0,speedo,0)
  158. spinf.MaxTorque = Vector3.new(speedo,speedo,speedo)
  159. local faws = Instance.new("BodyForce",spinnah)
  160. faws.Force = Vector3.new(0,spinnah:GetMass()*workspace.Gravity,0)
  161. spinnah.Velocity = chara.HumanoidRootPart.CFrame.lookVector*speedo
  162. spinnah.Touched:connect(function(hit)
  163. if hit.Parent ~= chara and hit.Parent:FindFirstChild("Humanoid") and faws ~= nil then
  164. faws:Destroy()
  165. faws = nil
  166. hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(10,20))
  167. spinf:Destroy()
  168. wait(5)
  169. for i = 0, 1, .1 do
  170. wait(.01)
  171. spinnah.Transparency = i
  172. end
  173. spinnah:Destroy()
  174. end
  175. end)
  176. end
  177. end
  178.  
  179. --Mouse Activation--
  180. if Mouse then
  181. Mouse.KeyDown:connect(onKeyDown)
  182. Mouse.Button1Down:connect(onButton1Down)
  183. end
  184.  
  185. --Loop--
  186. while true do
  187. rs:wait()
  188. FIJJETSPINNUHWELD.C0 = FIJJETSPINNUHWELD.C0 * CFrame.fromEulerAnglesXYZ(0,math.rad(speedo),0)
  189. end
Add Comment
Please, Sign In to add comment