Advertisement
sawgamer1

Untitled

Jun 27th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.43 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
  6.  
  7. --Converted with ttyyuu12345's model to script plugin v4
  8. function sandbox(var,func)
  9. local env = getfenv(func)
  10. local newenv = setmetatable({},{
  11. __index = function(self,k)
  12. if k=="script" then
  13. return var
  14. else
  15. return env[k]
  16. end
  17. end,
  18. })
  19. setfenv(func,newenv)
  20. return func
  21. end
  22. cors = {}
  23. mas = Instance.new("Model",game:GetService("Lighting"))
  24. Tool0 = Instance.new("Tool")
  25. LocalScript1 = Instance.new("LocalScript")
  26. LocalScript2 = Instance.new("LocalScript")
  27. Part3 = Instance.new("Part")
  28. CylinderMesh4 = Instance.new("CylinderMesh")
  29. Part5 = Instance.new("Part")
  30. CylinderMesh6 = Instance.new("CylinderMesh")
  31. Part7 = Instance.new("Part")
  32. CylinderMesh8 = Instance.new("CylinderMesh")
  33. Model9 = Instance.new("Model")
  34. Script10 = Instance.new("Script")
  35. Model11 = Instance.new("Model")
  36. MeshPart12 = Instance.new("MeshPart")
  37. MeshPart13 = Instance.new("MeshPart")
  38. MeshPart14 = Instance.new("MeshPart")
  39. MeshPart15 = Instance.new("MeshPart")
  40. MeshPart16 = Instance.new("MeshPart")
  41. MeshPart17 = Instance.new("MeshPart")
  42. MeshPart18 = Instance.new("MeshPart")
  43. MeshPart19 = Instance.new("MeshPart")
  44. MeshPart20 = Instance.new("MeshPart")
  45. MeshPart21 = Instance.new("MeshPart")
  46. MeshPart22 = Instance.new("MeshPart")
  47. MeshPart23 = Instance.new("MeshPart")
  48. MeshPart24 = Instance.new("MeshPart")
  49. MeshPart25 = Instance.new("MeshPart")
  50. MeshPart26 = Instance.new("MeshPart")
  51. MeshPart27 = Instance.new("MeshPart")
  52. Script28 = Instance.new("Script")
  53. Tool0.Name = "Flag"
  54. Tool0.Parent = mas
  55. LocalScript1.Name = "BackupWeld"
  56. LocalScript1.Parent = Tool0
  57. table.insert(cors,sandbox(LocalScript1,function()
  58. function Weld(x,y)
  59. local W = Instance.new("Weld")
  60. W.Part0 = x
  61. W.Part1 = y
  62. local CJ = CFrame.new(x.Position)
  63. local C0 = x.CFrame:inverse()*CJ
  64. local C1 = y.CFrame:inverse()*CJ
  65. W.C0 = C0
  66. W.C1 = C1
  67. W.Parent = x
  68. end
  69.  
  70. function Get(A)
  71. if A.className == "Part" then
  72. Weld(script.Parent.Handle, A)
  73. A.Anchored = false
  74. else
  75. local C = A:GetChildren()
  76. for i=1, #C do
  77. Get(C[i])
  78. end
  79. end
  80. end
  81.  
  82. function Finale()
  83. Get(script.Parent)
  84. end
  85.  
  86. script.Parent.Equipped:connect(Finale)
  87. script.Parent.Unequipped:connect(Finale)
  88. Finale()
  89. end))
  90. LocalScript2.Name = "FlagScript"
  91. LocalScript2.Parent = Tool0
  92. table.insert(cors,sandbox(LocalScript2,function()
  93. wait(.2)
  94. allStep=1/12
  95. local tool=script.Parent
  96. local weld33 = nil -- right arm
  97. local weld55 = nil
  98. local weld77 = nil
  99. local player = game.Players.LocalPlayer;
  100. local welds = {}
  101. local arms = nil
  102. local torso = nil
  103. local walk=false
  104. local twLs=0
  105. local twRs=0
  106. local twFs=0
  107. local cs=0
  108.  
  109. function tweenLeft(left)
  110. step=allStep
  111. local tweenfunction = function ()
  112. local oldPos = weld55.C1.p
  113. local oldAngle = Vector3.new(weld55.C1:toEulerAnglesXYZ())
  114. local newPos = left.p
  115. local newAngle = Vector3.new(left:toEulerAnglesXYZ())
  116. local twLs=cs
  117. local Loop = coroutine.create(function()
  118. for i = 0, 1, step do
  119. wait()
  120. if twLs~=cs then
  121. break
  122. end
  123. weld55.C1 = CFrame.new((oldPos*(1-i))+(newPos*i))*CFrame.fromEulerAnglesXYZ((oldAngle.x*(1-i))+(newAngle.x*i),(oldAngle.y*(1-i))+(newAngle.y*i),(oldAngle.z*(1-i))+(newAngle.z*i))
  124. end
  125. end)
  126. coroutine.resume(Loop)
  127.  
  128. end
  129. delay(0,tweenfunction)
  130. end
  131.  
  132. function tweenRight(left)
  133. step=allStep
  134. local tweenfunction = function ()
  135. local oldPos = weld33.C1.p
  136. local oldAngle = Vector3.new(weld33.C1:toEulerAnglesXYZ())
  137. local newPos = left.p
  138. local newAngle = Vector3.new(left:toEulerAnglesXYZ())
  139. local twRs=cs
  140. local Loop = coroutine.create(function()
  141. for i = 0, 1, step do
  142. wait()
  143. if twRs~=cs then
  144. break
  145. end
  146. weld33.C1 = CFrame.new((oldPos*(1-i))+(newPos*i))*CFrame.fromEulerAnglesXYZ((oldAngle.x*(1-i))+(newAngle.x*i),(oldAngle.y*(1-i))+(newAngle.y*i),(oldAngle.z*(1-i))+(newAngle.z*i))
  147. end
  148. end)
  149. coroutine.resume(Loop)
  150.  
  151. end
  152. delay(0,tweenfunction)
  153. end
  154.  
  155. function tweenFlag(left)
  156. step=allStep
  157. local tweenfunction = function ()
  158. local oldPos = weld77.C1.p
  159. local oldPos = Vector3.new(oldPos.x,oldPos.y,oldPos.z)
  160. local oldAngle = Vector3.new(weld77.C1:toEulerAnglesXYZ())
  161. local newPos = left.p
  162. local newAngle = Vector3.new(left:toEulerAnglesXYZ())
  163. local twFs=cs
  164. local Loop = coroutine.create(function()
  165. for i = 0, 1, step do
  166. if twFs~=cs then
  167. break
  168. end
  169. wait()
  170. weld77.C1 = CFrame.new((oldPos*(1-i))+(newPos*i))*CFrame.fromEulerAnglesXYZ((oldAngle.x*(1-i))+(newAngle.x*i),(oldAngle.y*(1-i))+(newAngle.y*i),(oldAngle.z*(1-i))+(newAngle.z*i))
  171. end
  172. end)
  173. coroutine.resume(Loop)
  174.  
  175. end
  176. delay(0,tweenfunction)
  177. end
  178.  
  179. function f(a,b,c,d,e,f)
  180. return (CFrame.new(a,b,c)*CFrame.Angles(math.rad(d),math.rad(e),math.rad(f))):inverse()
  181. end
  182.  
  183. function moved(d)
  184. if d>0 then
  185. if walk==false then
  186. walk=true
  187. cs=cs+1
  188. tweenLeft(f(-0.93,0.75,-1.02,120,37,50))
  189. tweenRight(f(1.04,0.15,-0.49,81,5,-44))
  190. tweenFlag(f(0.04,3.16,-1.52,-10,-90,0))
  191. end
  192. else
  193. if walk==true then
  194. walk=false
  195. cs=cs+1
  196.  
  197. tweenLeft(f(-1.12,0.3,-0.84,75,-4,15))
  198. tweenRight(f(0.1,0.17,-1.14,72,2,-52))
  199. tweenFlag(f(-0.76,1.93,-1.73,5,-90,0))
  200. end
  201. end
  202. end
  203.  
  204. function onEquippedLocal(mouse)
  205.  
  206. if mouse == nil then
  207. return
  208. end
  209. player.Character.Humanoid.Running:connect(moved)
  210.  
  211. -- mouse.Icon = "rbxasset://textures\\GunCursor.png"
  212. while true do
  213. wait()
  214. end
  215. end
  216.  
  217. function onUnequippedLocal(mouse)
  218.  
  219. end
  220.  
  221. function Equip(mouse)
  222. wait(0.01)
  223. tool.GripPos=Vector3.new(0,0,0)
  224. arms = {tool.Parent:FindFirstChild("Left Arm"), tool.Parent:FindFirstChild("Right Arm")}
  225. torso = tool.Parent:FindFirstChild("Torso")
  226. if arms ~= nil and torso ~= nil then
  227. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  228. if sh ~= nil then
  229. local yes = true
  230. if yes then
  231. yes = false
  232. sh[1].Part1 = nil
  233. sh[2].Part1 = nil
  234. local weld1 = Instance.new("Weld") -- left arm
  235. weld55 = weld1
  236. weld1.Part0 = torso
  237. weld1.Parent = torso
  238. weld1.Part1 = arms[1]
  239. weld1.C1 = f(-1.12,0.3,-0.84,75,-4,15)
  240. welds[1] = weld1
  241. local weld2 = Instance.new("Weld") -- right arm
  242. weld33 = weld2
  243. weld2.Part0 = torso
  244. weld2.Parent = torso
  245. weld2.Part1 = arms[2]
  246. weld2.C1 = f(0.1,0.17,-1.14,72,2,-52)
  247. welds[2] = weld2
  248. local weld3 = Instance.new("Weld") -- right arm
  249. weld77 = weld3
  250. weld3.Part0 = torso
  251. weld3.Parent = torso
  252. weld3.Part1 = tool.Handle
  253. weld3.C1 = f(-0.76,1.93,-1.73,5,-90,0)
  254. welds[3] = weld2
  255. end
  256. else
  257. end
  258. else
  259. end
  260. end
  261.  
  262. function Unequip(mouse)
  263. if arms ~= nil and torso ~= nil then
  264. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  265. if sh ~= nil then
  266. local yes = true
  267. if yes then
  268. yes = false
  269. sh[1].Part1 = arms[1]
  270. sh[2].Part1 = arms[2]
  271. welds[1].Parent = nil
  272. welds[2].Parent = nil
  273. end
  274. else
  275. end
  276. else
  277. end
  278. end
  279.  
  280. tool.Unequipped:connect(onUnequippedLocal)
  281.  
  282. tool.Equipped:connect(onEquippedLocal)
  283. tool.Equipped:connect(Equip)
  284. tool.Unequipped:connect(Unequip)
  285. end))
  286. Part3.Name = "Handle"
  287. Part3.Parent = Tool0
  288. Part3.CFrame = CFrame.new(-11.6699781, 5.14999819, 7.60995817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  289. Part3.Position = Vector3.new(-11.6699781, 5.14999819, 7.60995817)
  290. Part3.Color = Color3.new(0.486275, 0.360784, 0.27451)
  291. Part3.Size = Vector3.new(0.300000012, 10.3000002, 0.300000012)
  292. Part3.Anchored = true
  293. Part3.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  294. Part3.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  295. Part3.BrickColor = BrickColor.new("Brown")
  296. Part3.CanCollide = false
  297. Part3.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  298. Part3.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  299. Part3.Material = Enum.Material.Wood
  300. Part3.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  301. Part3.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  302. Part3.brickColor = BrickColor.new("Brown")
  303. Part3.FormFactor = Enum.FormFactor.Custom
  304. Part3.formFactor = Enum.FormFactor.Custom
  305. CylinderMesh4.Parent = Part3
  306. Part5.Name = "PoleCap"
  307. Part5.Parent = Tool0
  308. Part5.CFrame = CFrame.new(-11.6699781, 12.6498041, 7.60995817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  309. Part5.Position = Vector3.new(-11.6699781, 12.6498041, 7.60995817)
  310. Part5.Color = Color3.new(0.992157, 0.917647, 0.552941)
  311. Part5.Size = Vector3.new(0.400000006, 0.300000191, 0.400000006)
  312. Part5.Anchored = true
  313. Part5.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  314. Part5.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  315. Part5.BrickColor = BrickColor.new("Cool yellow")
  316. Part5.CanCollide = false
  317. Part5.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  318. Part5.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  319. Part5.Material = Enum.Material.Metal
  320. Part5.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  321. Part5.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  322. Part5.brickColor = BrickColor.new("Cool yellow")
  323. Part5.FormFactor = Enum.FormFactor.Custom
  324. Part5.formFactor = Enum.FormFactor.Custom
  325. CylinderMesh6.Parent = Part5
  326. Part7.Name = "FabricPole"
  327. Part7.Parent = Tool0
  328. Part7.CFrame = CFrame.new(-11.6699781, 10.069582, 7.60995817, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  329. Part7.Position = Vector3.new(-11.6699781, 10.069582, 7.60995817)
  330. Part7.Size = Vector3.new(0.310000002, 4.85999727, 0.310000002)
  331. Part7.Anchored = true
  332. Part7.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  333. Part7.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  334. Part7.CanCollide = false
  335. Part7.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  336. Part7.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  337. Part7.Material = Enum.Material.Fabric
  338. Part7.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  339. Part7.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  340. Part7.FormFactor = Enum.FormFactor.Custom
  341. Part7.formFactor = Enum.FormFactor.Custom
  342. CylinderMesh8.Parent = Part7
  343. Model9.Name = "AnimatedFlag"
  344. Model9.Parent = Tool0
  345. Script10.Name = "Animate"
  346. Script10.Parent = Model9
  347. table.insert(cors,sandbox(Script10,function()
  348. --Sinahi
  349.  
  350. --[[ReadMe*
  351. Please improve upon this script as needed, I'm a noob scripter and I only script
  352. through ways I know that work. This loop works, so I'm happy with it. But please,
  353. edit as you may.
  354.  
  355. This model uses MeshParts to animate the flag. The previous frame turns transparent
  356. while the next frame becomes visible.
  357.  
  358. If you would like to use your own custom flag, for your ROBLOX group or country,
  359. select all the children in the "Flag" model and paste in a ROBLOX decal asset in
  360. the "TextureID" slot. If you receive an error, try subtracting 1 from the decal id.
  361.  
  362. http://www.roblox.com/asset/?id={decal id}
  363. rbxassetid://{decal id}
  364.  
  365. Any ROBLOX decal in the Developers Library will work, or you may upload your own
  366. flag decal to insert in. Rectangular decals are recommended for this flag.
  367. *If you use a decal with a transparent background in the MeshPart's TextureID,
  368. the transparent background will default to black. Instead, insert the actual
  369. decal into every MeshPart in "Flag." This will allow you to change the BrickColor
  370. of the flag with the decal on top.
  371.  
  372. The flags have been UV mapped to flip the flag design on the other side.
  373. e.g. You won't see the blue box of the United States flag on the other side
  374. of the flag on its end, but close to the pole for both sides.
  375.  
  376. Thank you and have a wonderful day.
  377. (MeshParts rendered using Blender)
  378. --]]
  379.  
  380. sp=script.Parent
  381. flag=sp.Flag
  382.  
  383. reset=function()
  384. for _,meshpart in pairs (flag:GetChildren()) do
  385. if meshpart:IsA("MeshPart") then
  386. meshpart.Transparency=1
  387. end
  388. end
  389. end
  390.  
  391. waittime=.04 --Time between each "Frame"
  392.  
  393. while true do
  394. wait(waittime)
  395. reset()
  396. flag["2"].Transparency=0
  397. wait(waittime)
  398. reset()
  399. flag["3"].Transparency=0
  400. wait(waittime)
  401. reset()
  402. flag["4"].Transparency=0
  403. wait(waittime)
  404. reset()
  405. flag["5"].Transparency=0
  406. wait(waittime)
  407. reset()
  408. flag["6"].Transparency=0
  409. wait(waittime)
  410. reset()
  411. flag["7"].Transparency=0
  412. wait(waittime)
  413. reset()
  414. flag["8"].Transparency=0
  415. wait(waittime)
  416. reset()
  417. flag["9"].Transparency=0
  418. wait(waittime)
  419. reset()
  420. flag["10"].Transparency=0
  421. wait(waittime)
  422. reset()
  423. flag["11"].Transparency=0
  424. wait(waittime)
  425. reset()
  426. flag["12"].Transparency=0
  427. wait(waittime)
  428. reset()
  429. flag["13"].Transparency=0
  430. wait(waittime)
  431. reset()
  432. flag["14"].Transparency=0
  433. wait(waittime)
  434. reset()
  435. flag["15"].Transparency=0
  436. wait(waittime)
  437. reset()
  438. flag["16"].Transparency=0
  439. wait(waittime)
  440. reset()
  441. flag["1"].Transparency=0
  442. end
  443. end))
  444. Model11.Name = "Flag"
  445. Model11.Parent = Model9
  446. MeshPart12.Name = "16"
  447. MeshPart12.Parent = Model11
  448. MeshPart12.CFrame = CFrame.new(-7.548563, 10.0700817, 7.95722198, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  449. MeshPart12.Orientation = Vector3.new(0, -8.67000008, 0)
  450. MeshPart12.Position = Vector3.new(-7.548563, 10.0700817, 7.95722198)
  451. MeshPart12.Rotation = Vector3.new(0, -8.67000008, 0)
  452. MeshPart12.Transparency = 1
  453. MeshPart12.Size = Vector3.new(8.03175545, 4.87044287, 0.647605479)
  454. MeshPart12.Anchored = true
  455. MeshPart12.CanCollide = false
  456. MeshPart12.Material = Enum.Material.Fabric
  457. MeshPart12.TextureID = "rbxassetid://12680129"
  458. MeshPart13.Name = "15"
  459. MeshPart13.Parent = Model11
  460. MeshPart13.CFrame = CFrame.new(-7.54236603, 10.0700817, 7.92471695, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  461. MeshPart13.Orientation = Vector3.new(0, -8.67000008, 0)
  462. MeshPart13.Position = Vector3.new(-7.54236603, 10.0700817, 7.92471695)
  463. MeshPart13.Rotation = Vector3.new(0, -8.67000008, 0)
  464. MeshPart13.Transparency = 1
  465. MeshPart13.Size = Vector3.new(8.03480053, 4.87061262, 0.694280267)
  466. MeshPart13.Anchored = true
  467. MeshPart13.CanCollide = false
  468. MeshPart13.Material = Enum.Material.Fabric
  469. MeshPart13.TextureID = "rbxassetid://12680129"
  470. MeshPart14.Name = "8"
  471. MeshPart14.Parent = Model11
  472. MeshPart14.CFrame = CFrame.new(-7.54881001, 10.0700817, 7.66772699, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  473. MeshPart14.Orientation = Vector3.new(0, -8.67000008, 0)
  474. MeshPart14.Position = Vector3.new(-7.54881001, 10.0700817, 7.66772699)
  475. MeshPart14.Rotation = Vector3.new(0, -8.67000008, 0)
  476. MeshPart14.Transparency = 1
  477. MeshPart14.Size = Vector3.new(7.95339441, 4.87071705, 1.15461898)
  478. MeshPart14.Anchored = true
  479. MeshPart14.CanCollide = false
  480. MeshPart14.Material = Enum.Material.Fabric
  481. MeshPart14.TextureID = "rbxassetid://12680129"
  482. MeshPart15.Name = "7"
  483. MeshPart15.Parent = Model11
  484. MeshPart15.CFrame = CFrame.new(-7.54896402, 10.0700817, 7.68391895, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  485. MeshPart15.Orientation = Vector3.new(0, -8.67000008, 0)
  486. MeshPart15.Position = Vector3.new(-7.54896402, 10.0700817, 7.68391895)
  487. MeshPart15.Rotation = Vector3.new(0, -8.67000008, 0)
  488. MeshPart15.Transparency = 1
  489. MeshPart15.Size = Vector3.new(7.96737194, 4.87044287, 1.12576425)
  490. MeshPart15.Anchored = true
  491. MeshPart15.CanCollide = false
  492. MeshPart15.Material = Enum.Material.Fabric
  493. MeshPart15.TextureID = "rbxassetid://12680129"
  494. MeshPart16.Name = "6"
  495. MeshPart16.Parent = Model11
  496. MeshPart16.CFrame = CFrame.new(-7.53851509, 10.0700817, 7.70799398, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  497. MeshPart16.Orientation = Vector3.new(0, -8.67000008, 0)
  498. MeshPart16.Position = Vector3.new(-7.53851509, 10.0700817, 7.70799398)
  499. MeshPart16.Rotation = Vector3.new(0, -8.67000008, 0)
  500. MeshPart16.Transparency = 1
  501. MeshPart16.Size = Vector3.new(7.98077869, 4.87044287, 1.04999006)
  502. MeshPart16.Anchored = true
  503. MeshPart16.CanCollide = false
  504. MeshPart16.Material = Enum.Material.Fabric
  505. MeshPart16.TextureID = "rbxassetid://12680129"
  506. MeshPart17.Name = "5"
  507. MeshPart17.Parent = Model11
  508. MeshPart17.CFrame = CFrame.new(-7.53116322, 10.0700817, 7.76419306, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  509. MeshPart17.Orientation = Vector3.new(0, -8.67000008, 0)
  510. MeshPart17.Position = Vector3.new(-7.53116322, 10.0700817, 7.76419306)
  511. MeshPart17.Rotation = Vector3.new(0, -8.67000008, 0)
  512. MeshPart17.Transparency = 1
  513. MeshPart17.Size = Vector3.new(7.9919405, 4.87056875, 0.976310611)
  514. MeshPart17.Anchored = true
  515. MeshPart17.CanCollide = false
  516. MeshPart17.Material = Enum.Material.Fabric
  517. MeshPart17.TextureID = "rbxassetid://12680129"
  518. MeshPart18.Name = "4"
  519. MeshPart18.Parent = Model11
  520. MeshPart18.CFrame = CFrame.new(-7.52778721, 10.0700817, 7.81274605, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  521. MeshPart18.Orientation = Vector3.new(0, -8.67000008, 0)
  522. MeshPart18.Position = Vector3.new(-7.52778721, 10.0700817, 7.81274605)
  523. MeshPart18.Rotation = Vector3.new(0, -8.67000008, 0)
  524. MeshPart18.Transparency = 1
  525. MeshPart18.Size = Vector3.new(7.99492025, 4.87044287, 0.911806703)
  526. MeshPart18.Anchored = true
  527. MeshPart18.CanCollide = false
  528. MeshPart18.Material = Enum.Material.Fabric
  529. MeshPart18.TextureID = "rbxassetid://12680129"
  530. MeshPart19.Name = "3"
  531. MeshPart19.Parent = Model11
  532. MeshPart19.CFrame = CFrame.new(-7.55119324, 10.0700817, 7.83592701, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  533. MeshPart19.Orientation = Vector3.new(0, -8.67000008, 0)
  534. MeshPart19.Position = Vector3.new(-7.55119324, 10.0700817, 7.83592701)
  535. MeshPart19.Rotation = Vector3.new(0, -8.67000008, 0)
  536. MeshPart19.Transparency = 1
  537. MeshPart19.Size = Vector3.new(7.99696589, 4.87049198, 0.833267212)
  538. MeshPart19.Anchored = true
  539. MeshPart19.CanCollide = false
  540. MeshPart19.Material = Enum.Material.Fabric
  541. MeshPart19.TextureID = "rbxassetid://12680129"
  542. MeshPart20.Name = "9"
  543. MeshPart20.Parent = Model11
  544. MeshPart20.CFrame = CFrame.new(-7.53766108, 10.0700817, 7.66782188, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  545. MeshPart20.Orientation = Vector3.new(0, -8.67000008, 0)
  546. MeshPart20.Position = Vector3.new(-7.53766108, 10.0700817, 7.66782188)
  547. MeshPart20.Rotation = Vector3.new(0, -8.67000008, 0)
  548. MeshPart20.Transparency = 1
  549. MeshPart20.Size = Vector3.new(7.94530439, 4.8706007, 1.14960659)
  550. MeshPart20.Anchored = true
  551. MeshPart20.CanCollide = false
  552. MeshPart20.Material = Enum.Material.Fabric
  553. MeshPart20.TextureID = "rbxassetid://12680129"
  554. MeshPart21.Name = "2"
  555. MeshPart21.Parent = Model11
  556. MeshPart21.CFrame = CFrame.new(-7.54603195, 10.0700817, 7.86853695, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  557. MeshPart21.Orientation = Vector3.new(0, -8.67000008, 0)
  558. MeshPart21.Position = Vector3.new(-7.54603195, 10.0700817, 7.86853695)
  559. MeshPart21.Rotation = Vector3.new(0, -8.67000008, 0)
  560. MeshPart21.Transparency = 1
  561. MeshPart21.Size = Vector3.new(8.00397682, 4.87044287, 0.764522672)
  562. MeshPart21.Anchored = true
  563. MeshPart21.CanCollide = false
  564. MeshPart21.Material = Enum.Material.Fabric
  565. MeshPart21.TextureID = "rbxassetid://12680129"
  566. MeshPart22.Name = "14"
  567. MeshPart22.Parent = Model11
  568. MeshPart22.CFrame = CFrame.new(-7.52818108, 10.0700817, 7.84420776, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  569. MeshPart22.Orientation = Vector3.new(0, -8.67000008, 0)
  570. MeshPart22.Position = Vector3.new(-7.52818108, 10.0700817, 7.84420776)
  571. MeshPart22.Rotation = Vector3.new(0, -8.67000008, 0)
  572. MeshPart22.Transparency = 1
  573. MeshPart22.Size = Vector3.new(8.02695942, 4.87044573, 0.801810205)
  574. MeshPart22.Anchored = true
  575. MeshPart22.CanCollide = false
  576. MeshPart22.Material = Enum.Material.Fabric
  577. MeshPart22.TextureID = "rbxassetid://12680129"
  578. MeshPart23.Name = "13"
  579. MeshPart23.Parent = Model11
  580. MeshPart23.CFrame = CFrame.new(-7.534729, 10.0700817, 7.78042889, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  581. MeshPart23.Orientation = Vector3.new(0, -8.67000008, 0)
  582. MeshPart23.Position = Vector3.new(-7.534729, 10.0700817, 7.78042889)
  583. MeshPart23.Rotation = Vector3.new(0, -8.67000008, 0)
  584. MeshPart23.Transparency = 1
  585. MeshPart23.Size = Vector3.new(8.00423145, 4.87044287, 0.907351136)
  586. MeshPart23.Anchored = true
  587. MeshPart23.CanCollide = false
  588. MeshPart23.Material = Enum.Material.Fabric
  589. MeshPart23.TextureID = "rbxassetid://12680129"
  590. MeshPart24.Name = "12"
  591. MeshPart24.Parent = Model11
  592. MeshPart24.CFrame = CFrame.new(-7.533885, 10.0700817, 7.73129606, 0.988568902, 0, -0.150769979, 0, 1, 0, 0.150769979, 0, 0.988568902)
  593. MeshPart24.Orientation = Vector3.new(0, -8.67000008, 0)
  594. MeshPart24.Position = Vector3.new(-7.533885, 10.0700817, 7.73129606)
  595. MeshPart24.Rotation = Vector3.new(0, -8.67000008, 0)
  596. MeshPart24.Transparency = 1
  597. MeshPart24.Size = Vector3.new(7.97911882, 4.87044287, 1.00681031)
  598. MeshPart24.Anchored = true
  599. MeshPart24.CanCollide = false
  600. MeshPart24.Material = Enum.Material.Fabric
  601. MeshPart24.TextureID = "rbxassetid://12680129"
  602. MeshPart25.Name = "11"
  603. MeshPart25.Parent = Model11
  604. MeshPart25.CFrame = CFrame.new(-7.53773308, 10.0700817, 7.69966888, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  605. MeshPart25.Orientation = Vector3.new(0, -8.67000008, 0)
  606. MeshPart25.Position = Vector3.new(-7.53773308, 10.0700817, 7.69966888)
  607. MeshPart25.Rotation = Vector3.new(0, -8.67000008, 0)
  608. MeshPart25.Transparency = 1
  609. MeshPart25.Size = Vector3.new(7.95706892, 4.87054634, 1.06984007)
  610. MeshPart25.Anchored = true
  611. MeshPart25.CanCollide = false
  612. MeshPart25.Material = Enum.Material.Fabric
  613. MeshPart25.TextureID = "rbxassetid://12680129"
  614. MeshPart26.Name = "10"
  615. MeshPart26.Parent = Model11
  616. MeshPart26.CFrame = CFrame.new(-7.5421772, 10.0700817, 7.68396711, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  617. MeshPart26.Orientation = Vector3.new(0, -8.67000008, 0)
  618. MeshPart26.Position = Vector3.new(-7.5421772, 10.0700817, 7.68396711)
  619. MeshPart26.Rotation = Vector3.new(0, -8.67000008, 0)
  620. MeshPart26.Transparency = 1
  621. MeshPart26.Size = Vector3.new(7.94132566, 4.87067795, 1.12007439)
  622. MeshPart26.Anchored = true
  623. MeshPart26.CanCollide = false
  624. MeshPart26.Material = Enum.Material.Fabric
  625. MeshPart26.TextureID = "rbxassetid://12680129"
  626. MeshPart27.Name = "1"
  627. MeshPart27.Parent = Model11
  628. MeshPart27.CFrame = CFrame.new(-7.54079008, 10.0700817, 7.8844552, 0.988568783, 0, -0.150770992, 0, 1, 0, 0.150770977, 0, 0.988568783)
  629. MeshPart27.Orientation = Vector3.new(0, -8.67000008, 0)
  630. MeshPart27.Position = Vector3.new(-7.54079008, 10.0700817, 7.8844552)
  631. MeshPart27.Rotation = Vector3.new(0, -8.67000008, 0)
  632. MeshPart27.Size = Vector3.new(8.01558018, 4.87044287, 0.694967031)
  633. MeshPart27.Anchored = true
  634. MeshPart27.CanCollide = false
  635. MeshPart27.Material = Enum.Material.Fabric
  636. MeshPart27.TextureID = "rbxassetid://12680129"
  637. Script28.Name = "qPerfectionWeld"
  638. Script28.Parent = Tool0
  639. table.insert(cors,sandbox(Script28,function()
  640. -- Created by Quenty (@Quenty, follow me on twitter).
  641. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  642. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  643.  
  644. --[[ INSTRUCTIONS
  645. - Place in the model
  646. - Make sure model is anchored
  647. - That's it. It will weld the model and all children.
  648.  
  649. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  650. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  651. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  652. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  653. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  654. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  655. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  656. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  657.  
  658. 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.
  659. ]]
  660.  
  661. --[[ DOCUMENTATION
  662. - 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.
  663. - Will work in PBS servers
  664. - Will work as long as it starts out with the part anchored
  665. - Stores the relative CFrame as a CFrame value
  666. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  667. - Utilizes a recursive algorith to find all parts in the model
  668. - Will reweld on script reparent if the script is initially parented to a tool.
  669. - Welds as fast as possible
  670. ]]
  671.  
  672. -- qPerfectionWeld.lua
  673. -- Created 10/6/2014
  674. -- Author: Quenty
  675. -- Version 1.0.3
  676.  
  677. -- Updated 10/14/2014 - Updated to 1.0.1
  678. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  679.  
  680. -- Updated 10/14/2014 - Updated to 1.0.2
  681. --- Fixed bug fix.
  682.  
  683. -- Updated 10/14/2014 - Updated to 1.0.3
  684. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  685.  
  686. 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).
  687.  
  688.  
  689. local function CallOnChildren(Instance, FunctionToCall)
  690. -- Calls a function on each of the children of a certain object, using recursion.
  691.  
  692. FunctionToCall(Instance)
  693.  
  694. for _, Child in next, Instance:GetChildren() do
  695. CallOnChildren(Child, FunctionToCall)
  696. end
  697. end
  698.  
  699. local function GetNearestParent(Instance, ClassName)
  700. -- Returns the nearest parent of a certain class, or returns nil
  701.  
  702. local Ancestor = Instance
  703. repeat
  704. Ancestor = Ancestor.Parent
  705. if Ancestor == nil then
  706. return nil
  707. end
  708. until Ancestor:IsA(ClassName)
  709.  
  710. return Ancestor
  711. end
  712.  
  713. local function GetBricks(StartInstance)
  714. local List = {}
  715.  
  716. -- if StartInstance:IsA("BasePart") then
  717. -- List[#List+1] = StartInstance
  718. -- end
  719.  
  720. CallOnChildren(StartInstance, function(Item)
  721. if Item:IsA("BasePart") then
  722. List[#List+1] = Item;
  723. end
  724. end)
  725.  
  726. return List
  727. end
  728.  
  729. local function Modify(Instance, Values)
  730. -- Modifies an Instance by using a table.
  731.  
  732. assert(type(Values) == "table", "Values is not a table");
  733.  
  734. for Index, Value in next, Values do
  735. if type(Index) == "number" then
  736. Value.Parent = Instance
  737. else
  738. Instance[Index] = Value
  739. end
  740. end
  741. return Instance
  742. end
  743.  
  744. local function Make(ClassType, Properties)
  745. -- Using a syntax hack to create a nice way to Make new items.
  746.  
  747. return Modify(Instance.new(ClassType), Properties)
  748. end
  749.  
  750. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  751. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  752.  
  753. local function HasWheelJoint(Part)
  754. for _, SurfaceName in pairs(Surfaces) do
  755. for _, HingSurfaceName in pairs(HingSurfaces) do
  756. if Part[SurfaceName].Name == HingSurfaceName then
  757. return true
  758. end
  759. end
  760. end
  761.  
  762. return false
  763. end
  764.  
  765. local function ShouldBreakJoints(Part)
  766. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  767. -- definitely some edge cases.
  768.  
  769. if NEVER_BREAK_JOINTS then
  770. return false
  771. end
  772.  
  773. if HasWheelJoint(Part) then
  774. return false
  775. end
  776.  
  777. local Connected = Part:GetConnectedParts()
  778.  
  779. if #Connected == 1 then
  780. return false
  781. end
  782.  
  783. for _, Item in pairs(Connected) do
  784. if HasWheelJoint(Item) then
  785. return false
  786. elseif not Item:IsDescendantOf(script.Parent) then
  787. return false
  788. end
  789. end
  790.  
  791. return true
  792. end
  793.  
  794. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  795. --- Weld's 2 parts together
  796. -- @param Part0 The first part
  797. -- @param Part1 The second part (Dependent part most of the time).
  798. -- @param [JointType] The type of joint. Defaults to weld.
  799. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  800. -- @return The weld created.
  801.  
  802. JointType = JointType or "Weld"
  803. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  804.  
  805. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  806. Modify(NewWeld, {
  807. Name = "qCFrameWeldThingy";
  808. Part0 = Part0;
  809. Part1 = Part1;
  810. C0 = CFrame.new();--Part0.CFrame:inverse();
  811. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  812. Parent = Part1;
  813. })
  814.  
  815. if not RelativeValue then
  816. RelativeValue = Make("CFrameValue", {
  817. Parent = Part1;
  818. Name = "qRelativeCFrameWeldValue";
  819. Archivable = true;
  820. Value = NewWeld.C1;
  821. })
  822. end
  823.  
  824. return NewWeld
  825. end
  826.  
  827. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  828. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  829. -- @param MainPart The part to weld the model to (can be in the model).
  830. -- @param [JointType] The type of joint. Defaults to weld.
  831. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  832.  
  833. for _, Part in pairs(Parts) do
  834. if ShouldBreakJoints(Part) then
  835. Part:BreakJoints()
  836. end
  837. end
  838.  
  839. for _, Part in pairs(Parts) do
  840. if Part ~= MainPart then
  841. WeldTogether(MainPart, Part, JointType, MainPart)
  842. end
  843. end
  844.  
  845. if not DoNotUnanchor then
  846. for _, Part in pairs(Parts) do
  847. Part.Anchored = false
  848. end
  849. MainPart.Anchored = false
  850. end
  851. end
  852.  
  853. local function PerfectionWeld()
  854. local Tool = GetNearestParent(script, "Tool")
  855.  
  856. local Parts = GetBricks(script.Parent)
  857. 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]
  858.  
  859. if PrimaryPart then
  860. WeldParts(Parts, PrimaryPart, "Weld", false)
  861. else
  862. warn("qWeld - Unable to weld part")
  863. end
  864.  
  865. return Tool
  866. end
  867.  
  868. local Tool = PerfectionWeld()
  869.  
  870.  
  871. if Tool and script.ClassName == "Script" then
  872. --- Don't bother with local scripts
  873.  
  874. script.Parent.AncestryChanged:connect(function()
  875. PerfectionWeld()
  876. end)
  877. end
  878.  
  879. -- Created by Quenty (@Quenty, follow me on twitter).
  880.  
  881. end))
  882. for i,v in pairs(mas:GetChildren()) do
  883. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  884. pcall(function() v:MakeJoints() end)
  885. end
  886. mas:Destroy()
  887. for i,v in pairs(cors) do
  888. spawn(function()
  889. pcall(v)
  890. end)
  891. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement