Advertisement
antoniorigo4

why are you wasting my limit of posting per day

Jan 8th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.40 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Tool0 = Instance.new("Tool")
  19. Script1 = Instance.new("Script")
  20. Part2 = Instance.new("Part")
  21. Part3 = Instance.new("Part")
  22. ParticleEmitter4 = Instance.new("ParticleEmitter")
  23. Script5 = Instance.new("Script")
  24. Part6 = Instance.new("Part")
  25. Part7 = Instance.new("Part")
  26. Part8 = Instance.new("Part")
  27. Part9 = Instance.new("Part")
  28. Part10 = Instance.new("Part")
  29. Tool0.Parent = mas
  30. Tool0.Grip = CFrame.new(0.201544508, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  31. Tool0.GripPos = Vector3.new(0.201544508, 0, 0)
  32. Script1.Name = "qPerfectionWeld"
  33. Script1.Parent = Tool0
  34. table.insert(cors,sandbox(Script1,function()
  35. -- Created by Quenty (@Quenty, follow me on twitter).
  36. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  37. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  38.  
  39. --[[ INSTRUCTIONS
  40. - Place in the model
  41. - Make sure model is anchored
  42. - That's it. It will weld the model and all children.
  43.  
  44. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  45. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  46. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  47. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  48. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  49. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  50. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  51. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  52.  
  53. 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.
  54. ]]
  55.  
  56. --[[ DOCUMENTATION
  57. - 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.
  58. - Will work in PBS servers
  59. - Will work as long as it starts out with the part anchored
  60. - Stores the relative CFrame as a CFrame value
  61. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  62. - Utilizes a recursive algorith to find all parts in the model
  63. - Will reweld on script reparent if the script is initially parented to a tool.
  64. - Welds as fast as possible
  65. ]]
  66.  
  67. -- qPerfectionWeld.lua
  68. -- Created 10/6/2014
  69. -- Author: Quenty
  70. -- Version 1.0.3
  71.  
  72. -- Updated 10/14/2014 - Updated to 1.0.1
  73. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  74.  
  75. -- Updated 10/14/2014 - Updated to 1.0.2
  76. --- Fixed bug fix.
  77.  
  78. -- Updated 10/14/2014 - Updated to 1.0.3
  79. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  80.  
  81. 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).
  82.  
  83.  
  84. local function CallOnChildren(Instance, FunctionToCall)
  85. -- Calls a function on each of the children of a certain object, using recursion.
  86.  
  87. FunctionToCall(Instance)
  88.  
  89. for _, Child in next, Instance:GetChildren() do
  90. CallOnChildren(Child, FunctionToCall)
  91. end
  92. end
  93.  
  94. local function GetNearestParent(Instance, ClassName)
  95. -- Returns the nearest parent of a certain class, or returns nil
  96.  
  97. local Ancestor = Instance
  98. repeat
  99. Ancestor = Ancestor.Parent
  100. if Ancestor == nil then
  101. return nil
  102. end
  103. until Ancestor:IsA(ClassName)
  104.  
  105. return Ancestor
  106. end
  107.  
  108. local function GetBricks(StartInstance)
  109. local List = {}
  110.  
  111. -- if StartInstance:IsA("BasePart") then
  112. -- List[#List+1] = StartInstance
  113. -- end
  114.  
  115. CallOnChildren(StartInstance, function(Item)
  116. if Item:IsA("BasePart") then
  117. List[#List+1] = Item;
  118. end
  119. end)
  120.  
  121. return List
  122. end
  123.  
  124. local function Modify(Instance, Values)
  125. -- Modifies an Instance by using a table.
  126.  
  127. assert(type(Values) == "table", "Values is not a table");
  128.  
  129. for Index, Value in next, Values do
  130. if type(Index) == "number" then
  131. Value.Parent = Instance
  132. else
  133. Instance[Index] = Value
  134. end
  135. end
  136. return Instance
  137. end
  138.  
  139. local function Make(ClassType, Properties)
  140. -- Using a syntax hack to create a nice way to Make new items.
  141.  
  142. return Modify(Instance.new(ClassType), Properties)
  143. end
  144.  
  145. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  146. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  147.  
  148. local function HasWheelJoint(Part)
  149. for _, SurfaceName in pairs(Surfaces) do
  150. for _, HingSurfaceName in pairs(HingSurfaces) do
  151. if Part[SurfaceName].Name == HingSurfaceName then
  152. return true
  153. end
  154. end
  155. end
  156.  
  157. return false
  158. end
  159.  
  160. local function ShouldBreakJoints(Part)
  161. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  162. -- definitely some edge cases.
  163.  
  164. if NEVER_BREAK_JOINTS then
  165. return false
  166. end
  167.  
  168. if HasWheelJoint(Part) then
  169. return false
  170. end
  171.  
  172. local Connected = Part:GetConnectedParts()
  173.  
  174. if #Connected == 1 then
  175. return false
  176. end
  177.  
  178. for _, Item in pairs(Connected) do
  179. if HasWheelJoint(Item) then
  180. return false
  181. elseif not Item:IsDescendantOf(script.Parent) then
  182. return false
  183. end
  184. end
  185.  
  186. return true
  187. end
  188.  
  189. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  190. --- Weld's 2 parts together
  191. -- @param Part0 The first part
  192. -- @param Part1 The second part (Dependent part most of the time).
  193. -- @param [JointType] The type of joint. Defaults to weld.
  194. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  195. -- @return The weld created.
  196.  
  197. JointType = JointType or "Weld"
  198. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  199.  
  200. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  201. Modify(NewWeld, {
  202. Name = "qCFrameWeldThingy";
  203. Part0 = Part0;
  204. Part1 = Part1;
  205. C0 = CFrame.new();--Part0.CFrame:inverse();
  206. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  207. Parent = Part1;
  208. })
  209.  
  210. if not RelativeValue then
  211. RelativeValue = Make("CFrameValue", {
  212. Parent = Part1;
  213. Name = "qRelativeCFrameWeldValue";
  214. Archivable = true;
  215. Value = NewWeld.C1;
  216. })
  217. end
  218.  
  219. return NewWeld
  220. end
  221.  
  222. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  223. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  224. -- @param MainPart The part to weld the model to (can be in the model).
  225. -- @param [JointType] The type of joint. Defaults to weld.
  226. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  227.  
  228. for _, Part in pairs(Parts) do
  229. if ShouldBreakJoints(Part) then
  230. Part:BreakJoints()
  231. end
  232. end
  233.  
  234. for _, Part in pairs(Parts) do
  235. if Part ~= MainPart then
  236. WeldTogether(MainPart, Part, JointType, MainPart)
  237. end
  238. end
  239.  
  240. if not DoNotUnanchor then
  241. for _, Part in pairs(Parts) do
  242. Part.Anchored = false
  243. end
  244. MainPart.Anchored = false
  245. end
  246. end
  247.  
  248. local function PerfectionWeld()
  249. local Tool = GetNearestParent(script, "Tool")
  250.  
  251. local Parts = GetBricks(script.Parent)
  252. 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]
  253.  
  254. if PrimaryPart then
  255. WeldParts(Parts, PrimaryPart, "Weld", false)
  256. else
  257. warn("qWeld - Unable to weld part")
  258. end
  259.  
  260. return Tool
  261. end
  262.  
  263. local Tool = PerfectionWeld()
  264.  
  265.  
  266. if Tool and script.ClassName == "Script" then
  267. --- Don't bother with local scripts
  268.  
  269. script.Parent.AncestryChanged:connect(function()
  270. PerfectionWeld()
  271. end)
  272. end
  273.  
  274. -- Created by Quenty (@Quenty, follow me on twitter).
  275.  
  276. end))
  277. Part2.Name = "Handle"
  278. Part2.Parent = Tool0
  279. Part2.CFrame = CFrame.new(-2.00003052, 7.50011444, 32.0004883, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  280. Part2.Position = Vector3.new(-2.00003052, 7.50011444, 32.0004883)
  281. Part2.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  282. Part2.Size = Vector3.new(2, 1, 2)
  283. Part2.BottomSurface = Enum.SurfaceType.Smooth
  284. Part2.BrickColor = BrickColor.new("Really black")
  285. Part2.TopSurface = Enum.SurfaceType.Smooth
  286. Part2.brickColor = BrickColor.new("Really black")
  287. Part3.Name = "KillPart"
  288. Part3.Parent = Tool0
  289. Part3.CFrame = CFrame.new(-2.00003052, 6.97471571, 32.0004883, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  290. Part3.Position = Vector3.new(-2.00003052, 6.97471571, 32.0004883)
  291. Part3.Color = Color3.new(1, 0, 0)
  292. Part3.Size = Vector3.new(2, 0.0500000007, 2)
  293. Part3.BottomSurface = Enum.SurfaceType.Smooth
  294. Part3.BrickColor = BrickColor.new("Really red")
  295. Part3.Material = Enum.Material.Neon
  296. Part3.TopSurface = Enum.SurfaceType.Smooth
  297. Part3.brickColor = BrickColor.new("Really red")
  298. ParticleEmitter4.Parent = Part3
  299. ParticleEmitter4.Color = ColorSequence.new(Color3.new(1, 0, 0),Color3.new(1, 0, 0))
  300. ParticleEmitter4.LightInfluence = 1
  301. ParticleEmitter4.Lifetime = NumberRange.new(0.5, 0.5)
  302. Script5.Parent = Part3
  303. table.insert(cors,sandbox(Script5,function()
  304. script.parent.Touched:connect(function(hit)
  305. if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
  306. hit.Parent.Humanoid.Health = 0
  307. end
  308. end)
  309. end))
  310. Part6.Parent = Tool0
  311. Part6.CFrame = CFrame.new(-2.00003052, 9.00013733, 32.0004883, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  312. Part6.Position = Vector3.new(-2.00003052, 9.00013733, 32.0004883)
  313. Part6.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  314. Part6.Size = Vector3.new(2, 2, 2)
  315. Part6.BottomSurface = Enum.SurfaceType.Smooth
  316. Part6.BrickColor = BrickColor.new("Really black")
  317. Part6.TopSurface = Enum.SurfaceType.Smooth
  318. Part6.brickColor = BrickColor.new("Really black")
  319. Part7.Parent = Tool0
  320. Part7.CFrame = CFrame.new(-0.974624276, 9.50014496, 32.0004883, -1.1920929e-07, 0, 1.00000012, 0, 1, 0, -1.00000012, 0, -1.1920929e-07)
  321. Part7.Orientation = Vector3.new(0, 90, 0)
  322. Part7.Position = Vector3.new(-0.974624276, 9.50014496, 32.0004883)
  323. Part7.Rotation = Vector3.new(0, 90, 0)
  324. Part7.Color = Color3.new(0, 1, 0)
  325. Part7.Size = Vector3.new(2, 1, 0.0500000007)
  326. Part7.BottomSurface = Enum.SurfaceType.Smooth
  327. Part7.BrickColor = BrickColor.new("Lime green")
  328. Part7.Material = Enum.Material.Neon
  329. Part7.TopSurface = Enum.SurfaceType.Smooth
  330. Part7.brickColor = BrickColor.new("Lime green")
  331. Part8.Parent = Tool0
  332. Part8.CFrame = CFrame.new(-3.02543688, 9.50014496, 32.0004883, -1.1920929e-07, 0, -1.00000012, 0, 1, 0, 1.00000012, 0, -1.1920929e-07)
  333. Part8.Orientation = Vector3.new(0, -90, 0)
  334. Part8.Position = Vector3.new(-3.02543688, 9.50014496, 32.0004883)
  335. Part8.Rotation = Vector3.new(0, -90, 0)
  336. Part8.Color = Color3.new(0, 1, 0)
  337. Part8.Size = Vector3.new(2, 1, 0.0500000007)
  338. Part8.BottomSurface = Enum.SurfaceType.Smooth
  339. Part8.BrickColor = BrickColor.new("Lime green")
  340. Part8.Material = Enum.Material.Neon
  341. Part8.TopSurface = Enum.SurfaceType.Smooth
  342. Part8.brickColor = BrickColor.new("Lime green")
  343. Part9.Parent = Tool0
  344. Part9.CFrame = CFrame.new(-2.00003052, 9.50014496, 30.9750824, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  345. Part9.Orientation = Vector3.new(0, 180, 0)
  346. Part9.Position = Vector3.new(-2.00003052, 9.50014496, 30.9750824)
  347. Part9.Rotation = Vector3.new(-180, 0, -180)
  348. Part9.Color = Color3.new(0, 1, 0)
  349. Part9.Size = Vector3.new(2, 1, 0.0500000007)
  350. Part9.BottomSurface = Enum.SurfaceType.Smooth
  351. Part9.BrickColor = BrickColor.new("Lime green")
  352. Part9.Material = Enum.Material.Neon
  353. Part9.TopSurface = Enum.SurfaceType.Smooth
  354. Part9.brickColor = BrickColor.new("Lime green")
  355. Part10.Parent = Tool0
  356. Part10.CFrame = CFrame.new(-2.00003052, 9.50014496, 33.0249176, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  357. Part10.Position = Vector3.new(-2.00003052, 9.50014496, 33.0249176)
  358. Part10.Color = Color3.new(0, 1, 0)
  359. Part10.Size = Vector3.new(2, 1, 0.0500000007)
  360. Part10.BottomSurface = Enum.SurfaceType.Smooth
  361. Part10.BrickColor = BrickColor.new("Lime green")
  362. Part10.Material = Enum.Material.Neon
  363. Part10.TopSurface = Enum.SurfaceType.Smooth
  364. Part10.brickColor = BrickColor.new("Lime green")
  365. for i,v in pairs(mas:GetChildren()) do
  366. v.Parent = workspace
  367. pcall(function() v:MakeJoints() end)
  368. end
  369. mas:Destroy()
  370. for i,v in pairs(cors) do
  371. spawn(function()
  372. pcall(v)
  373. end)
  374. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement