Advertisement
N0ePlox

Lib tard killer 1337

Nov 25th, 2018
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.86 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. Part2 = Instance.new("Part")
  22. Script3 = Instance.new("Script")
  23. Script4 = Instance.new("Script")
  24. Tool0.Name = "Liberal Destroyer"
  25. Tool0.Parent = mas
  26. Tool0.Grip = CFrame.new(14.7119808, -0.218165174, -0.200894296, 0.0426819362, -0.00720868958, 0.999062717, -0.058360327, 0.998248518, 0.00969608314, -0.99738276, -0.0587194711, 0.0421864726)
  27. Tool0.GripForward = Vector3.new(-0.999062717, -0.00969608314, -0.0421864726)
  28. Tool0.GripPos = Vector3.new(14.7119808, -0.218165174, -0.200894296)
  29. Tool0.GripRight = Vector3.new(0.0426819362, -0.058360327, -0.99738276)
  30. Tool0.GripUp = Vector3.new(-0.00720868958, 0.998248518, -0.0587194711)
  31. Part1.Name = "Handle"
  32. Part1.Parent = Tool0
  33. Part1.CFrame = CFrame.new(-16.2499847, 1.94999981, -24.8499985, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  34. Part1.Position = Vector3.new(-16.2499847, 1.94999981, -24.8499985)
  35. Part1.Color = Color3.new(0.415686, 0.223529, 0.0352941)
  36. Part1.Size = Vector3.new(32.1000099, 0.300000548, 0.299999952)
  37. Part1.BottomSurface = Enum.SurfaceType.Smooth
  38. Part1.BrickColor = BrickColor.new("Burnt Sienna")
  39. Part1.CanCollide = false
  40. Part1.TopSurface = Enum.SurfaceType.Smooth
  41. Part1.brickColor = BrickColor.new("Burnt Sienna")
  42. Part2.Name = "Smooth Block Model"
  43. Part2.Parent = Tool0
  44. Part2.CFrame = CFrame.new(-18.6499863, 2.00000024, -24.9999981, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  45. Part2.Orientation = Vector3.new(0, 180, 0)
  46. Part2.Position = Vector3.new(-18.6499863, 2.00000024, -24.9999981)
  47. Part2.Rotation = Vector3.new(-180, 0, -180)
  48. Part2.Color = Color3.new(0.886275, 0.607843, 0.25098)
  49. Part2.Transparency = 1
  50. Part2.Size = Vector3.new(27.9000072, 0.999999702, 1)
  51. Part2.Anchored = true
  52. Part2.BrickColor = BrickColor.new("Br. yellowish orange")
  53. Part2.CanCollide = false
  54. Part2.brickColor = BrickColor.new("Br. yellowish orange")
  55. Script3.Parent = Part2
  56. table.insert(cors,sandbox(Script3,function()
  57. script.Parent.Touched:connect(function(part)
  58. local boom = Instance.new("Explosion")
  59. boom.Parent = game.Workspace
  60. boom.Position = part.Position
  61. end)
  62.  
  63. end))
  64. Script4.Name = "qPerfectionWeld"
  65. Script4.Parent = Tool0
  66. table.insert(cors,sandbox(Script4,function()
  67. -- Created by Quenty (@Quenty, follow me on twitter).
  68. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  69. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  70.  
  71. --[[ INSTRUCTIONS
  72. - Place in the model
  73. - Make sure model is anchored
  74. - That's it. It will weld the model and all children.
  75.  
  76. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  77. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  78. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  79. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  80. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  81. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  82. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  83. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  84.  
  85. This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
  86. ]]
  87.  
  88. --[[ DOCUMENTATION
  89. - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  90. - Will work in PBS servers
  91. - Will work as long as it starts out with the part anchored
  92. - Stores the relative CFrame as a CFrame value
  93. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  94. - Utilizes a recursive algorith to find all parts in the model
  95. - Will reweld on script reparent if the script is initially parented to a tool.
  96. - Welds as fast as possible
  97. ]]
  98.  
  99. -- qPerfectionWeld.lua
  100. -- Created 10/6/2014
  101. -- Author: Quenty
  102. -- Version 1.0.3
  103.  
  104. -- Updated 10/14/2014 - Updated to 1.0.1
  105. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  106.  
  107. -- Updated 10/14/2014 - Updated to 1.0.2
  108. --- Fixed bug fix.
  109.  
  110. -- Updated 10/14/2014 - Updated to 1.0.3
  111. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  112.  
  113. local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
  114.  
  115.  
  116. local function CallOnChildren(Instance, FunctionToCall)
  117. -- Calls a function on each of the children of a certain object, using recursion.
  118.  
  119. FunctionToCall(Instance)
  120.  
  121. for _, Child in next, Instance:GetChildren() do
  122. CallOnChildren(Child, FunctionToCall)
  123. end
  124. end
  125.  
  126. local function GetNearestParent(Instance, ClassName)
  127. -- Returns the nearest parent of a certain class, or returns nil
  128.  
  129. local Ancestor = Instance
  130. repeat
  131. Ancestor = Ancestor.Parent
  132. if Ancestor == nil then
  133. return nil
  134. end
  135. until Ancestor:IsA(ClassName)
  136.  
  137. return Ancestor
  138. end
  139.  
  140. local function GetBricks(StartInstance)
  141. local List = {}
  142.  
  143. -- if StartInstance:IsA("BasePart") then
  144. -- List[#List+1] = StartInstance
  145. -- end
  146.  
  147. CallOnChildren(StartInstance, function(Item)
  148. if Item:IsA("BasePart") then
  149. List[#List+1] = Item;
  150. end
  151. end)
  152.  
  153. return List
  154. end
  155.  
  156. local function Modify(Instance, Values)
  157. -- Modifies an Instance by using a table.
  158.  
  159. assert(type(Values) == "table", "Values is not a table");
  160.  
  161. for Index, Value in next, Values do
  162. if type(Index) == "number" then
  163. Value.Parent = Instance
  164. else
  165. Instance[Index] = Value
  166. end
  167. end
  168. return Instance
  169. end
  170.  
  171. local function Make(ClassType, Properties)
  172. -- Using a syntax hack to create a nice way to Make new items.
  173.  
  174. return Modify(Instance.new(ClassType), Properties)
  175. end
  176.  
  177. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  178. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  179.  
  180. local function HasWheelJoint(Part)
  181. for _, SurfaceName in pairs(Surfaces) do
  182. for _, HingSurfaceName in pairs(HingSurfaces) do
  183. if Part[SurfaceName].Name == HingSurfaceName then
  184. return true
  185. end
  186. end
  187. end
  188.  
  189. return false
  190. end
  191.  
  192. local function ShouldBreakJoints(Part)
  193. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  194. -- definitely some edge cases.
  195.  
  196. if NEVER_BREAK_JOINTS then
  197. return false
  198. end
  199.  
  200. if HasWheelJoint(Part) then
  201. return false
  202. end
  203.  
  204. local Connected = Part:GetConnectedParts()
  205.  
  206. if #Connected == 1 then
  207. return false
  208. end
  209.  
  210. for _, Item in pairs(Connected) do
  211. if HasWheelJoint(Item) then
  212. return false
  213. elseif not Item:IsDescendantOf(script.Parent) then
  214. return false
  215. end
  216. end
  217.  
  218. return true
  219. end
  220.  
  221. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  222. --- Weld's 2 parts together
  223. -- @param Part0 The first part
  224. -- @param Part1 The second part (Dependent part most of the time).
  225. -- @param [JointType] The type of joint. Defaults to weld.
  226. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  227. -- @return The weld created.
  228.  
  229. JointType = JointType or "Weld"
  230. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  231.  
  232. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  233. Modify(NewWeld, {
  234. Name = "qCFrameWeldThingy";
  235. Part0 = Part0;
  236. Part1 = Part1;
  237. C0 = CFrame.new();--Part0.CFrame:inverse();
  238. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  239. Parent = Part1;
  240. })
  241.  
  242. if not RelativeValue then
  243. RelativeValue = Make("CFrameValue", {
  244. Parent = Part1;
  245. Name = "qRelativeCFrameWeldValue";
  246. Archivable = true;
  247. Value = NewWeld.C1;
  248. })
  249. end
  250.  
  251. return NewWeld
  252. end
  253.  
  254. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  255. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  256. -- @param MainPart The part to weld the model to (can be in the model).
  257. -- @param [JointType] The type of joint. Defaults to weld.
  258. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  259.  
  260. for _, Part in pairs(Parts) do
  261. if ShouldBreakJoints(Part) then
  262. Part:BreakJoints()
  263. end
  264. end
  265.  
  266. for _, Part in pairs(Parts) do
  267. if Part ~= MainPart then
  268. WeldTogether(MainPart, Part, JointType, MainPart)
  269. end
  270. end
  271.  
  272. if not DoNotUnanchor then
  273. for _, Part in pairs(Parts) do
  274. Part.Anchored = false
  275. end
  276. MainPart.Anchored = false
  277. end
  278. end
  279.  
  280. local function PerfectionWeld()
  281. local Tool = GetNearestParent(script, "Tool")
  282.  
  283. local Parts = GetBricks(script.Parent)
  284. local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
  285.  
  286. if PrimaryPart then
  287. WeldParts(Parts, PrimaryPart, "Weld", false)
  288. else
  289. warn("qWeld - Unable to weld part")
  290. end
  291.  
  292. return Tool
  293. end
  294.  
  295. local Tool = PerfectionWeld()
  296.  
  297.  
  298. if Tool and script.ClassName == "Script" then
  299. --- Don't bother with local scripts
  300.  
  301. script.Parent.AncestryChanged:connect(function()
  302. PerfectionWeld()
  303. end)
  304. end
  305.  
  306. -- Created by Quenty (@Quenty, follow me on twitter).
  307.  
  308. end))
  309. for i,v in pairs(mas:GetChildren()) do
  310. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  311. pcall(function() v:MakeJoints() end)
  312. end
  313. mas:Destroy()
  314. for i,v in pairs(cors) do
  315. spawn(function()
  316. pcall(v)
  317. end)
  318. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement