Advertisement
Plug_RBLX

fidget

Dec 30th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. function sandbox(var,func)
  2. local env = getfenv(func)
  3. local newenv = setmetatable({},{
  4. __index = function(self,k)
  5. if k=="script" then
  6. return var
  7. else
  8. return env[k]
  9. end
  10. end,
  11. })
  12. setfenv(func,newenv)
  13. return func
  14. end
  15. cors = {}
  16. mas = Instance.new("Model",game:GetService("Lighting"))
  17. Tool0 = Instance.new("Tool")
  18. Script1 = Instance.new("Script")
  19. Part2 = Instance.new("Part")
  20. Decal3 = Instance.new("Decal")
  21. Tool0.Name = "Fidget"
  22. Tool0.Parent = mas
  23. Script1.Name = "WeldScript"
  24. Script1.Parent = Tool0
  25. table.insert(cors,sandbox(Script1,function()
  26. -- Simple Welding Script by Plugined. No credit necessary.
  27.  
  28. --[[
  29. To use, Simply place this inside the model you want to use. If you want the model unanchored, Set unanchor to true. If not, set it to
  30. false. If there are any part classes in your model that aren't in the class list, Just add it in. Make sure to use the EXACT name.
  31.  
  32. MAKE SURE THE ENIRE MODEL IS ANCHORED BEFORE USE! Otherwise all the parts will glitch and go out of place and they'll look ugly.
  33.  
  34. If you want to remove all welds from your model, Just set removeWelds to true. (If you ever used the qPerfectionWeld script, This will
  35. also remove all those annoying CFrame values as well.)
  36. --]]
  37.  
  38. unanchor = false
  39.  
  40. removeWelds = false
  41.  
  42. classes = {
  43. "Part";
  44. "WedgePart";
  45. "TrussPart";
  46. "CornerWedgePart";
  47. "Seat";
  48. "VehicleSeat";
  49. "UnionOperation";
  50. "NegateOperation";
  51. "MeshPart";
  52. "SpawnLocation";
  53. }
  54.  
  55. -- Don't edit anything down here unless you know what you're doing.
  56.  
  57. function createWeld(p1, p2)
  58. local weld = Instance.new("Weld", p1)
  59. weld.C0 = p1.CFrame:inverse() * p2.CFrame
  60. weld.Part0 = p1
  61. weld.Part1 = p2
  62. end
  63.  
  64. function checkWelds(model)
  65. local prev
  66. local c = model:GetChildren()
  67. for i = 1, #c do
  68. for a = 1, #classes do
  69. if c[i].ClassName == classes[a] then
  70. local oldWeld = c[i]:FindFirstChildOfClass("Weld")
  71. if oldWeld ~= nil then
  72. oldWeld:Destroy()
  73. end
  74. local oldCFrame = c[i]:FindFirstChildOfClass("CFrameValue")
  75. if oldCFrame ~= nil then
  76. oldCFrame:Destroy()
  77. end
  78. if removeWelds == false then
  79. if unanchor == true then
  80. c[i].Anchored = false
  81. end
  82. if prev ~= nil then
  83. createWeld(prev, c[i])
  84. end
  85. prev = c[i]
  86. end
  87. end
  88. end
  89. checkWelds(c[i])
  90. end
  91. end
  92.  
  93. checkWelds(script.Parent)
  94. end))
  95. Part2.Name = "Handle"
  96. Part2.Parent = Tool0
  97. Part2.Size = Vector3.new(4, 4.85000086, 0.0500000007)
  98. Part2.CFrame = CFrame.new(-20.6899986, 2.42500424, -25.3449955, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  99. Part2.BottomSurface = Enum.SurfaceType.Smooth
  100. Part2.TopSurface = Enum.SurfaceType.Smooth
  101. Part2.Position = Vector3.new(-20.6899986, 2.42500424, -25.3449955)
  102. Decal3.Parent = Part2
  103. Decal3.Texture = "http://www.roblox.com/asset/?id=875084006"
  104. for i,v in pairs(mas:GetChildren()) do
  105. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  106. pcall(function() v:MakeJoints() end)
  107. end
  108. mas:Destroy()
  109. for i,v in pairs(cors) do
  110. spawn(function()
  111. pcall(v)
  112. end)
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement