cat568

Untitled

Dec 23rd, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 44.40 KB | None | 0 0
  1.  
  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. Model0 = Instance.new("Model")
  19. Model1 = Instance.new("Model")
  20. Folder2 = Instance.new("Folder")
  21. NumberValue3 = Instance.new("NumberValue")
  22. NumberValue4 = Instance.new("NumberValue")
  23. MeshPart5 = Instance.new("MeshPart")
  24. MeshPart6 = Instance.new("MeshPart")
  25. MeshPart7 = Instance.new("MeshPart")
  26. MeshPart8 = Instance.new("MeshPart")
  27. MeshPart9 = Instance.new("MeshPart")
  28. VehicleSeat10 = Instance.new("VehicleSeat")
  29. Sound11 = Instance.new("Sound")
  30. Sound12 = Instance.new("Sound")
  31. Script13 = Instance.new("Script")
  32. LocalScript14 = Instance.new("LocalScript")
  33. ObjectValue15 = Instance.new("ObjectValue")
  34. BodyAngularVelocity16 = Instance.new("BodyAngularVelocity")
  35. BodyGyro17 = Instance.new("BodyGyro")
  36. BodyVelocity18 = Instance.new("BodyVelocity")
  37. Script19 = Instance.new("Script")
  38. LocalScript20 = Instance.new("LocalScript")
  39. ModuleScript21 = Instance.new("ModuleScript")
  40. ScreenGui22 = Instance.new("ScreenGui")
  41. ObjectValue23 = Instance.new("ObjectValue")
  42. Frame24 = Instance.new("Frame")
  43. TextLabel25 = Instance.new("TextLabel")
  44. TextLabel26 = Instance.new("TextLabel")
  45. LocalScript27 = Instance.new("LocalScript")
  46. Frame28 = Instance.new("Frame")
  47. TextLabel29 = Instance.new("TextLabel")
  48. TextButton30 = Instance.new("TextButton")
  49. LocalScript31 = Instance.new("LocalScript")
  50. TextButton32 = Instance.new("TextButton")
  51. LocalScript33 = Instance.new("LocalScript")
  52. TextButton34 = Instance.new("TextButton")
  53. LocalScript35 = Instance.new("LocalScript")
  54. TextLabel36 = Instance.new("TextLabel")
  55. TextButton37 = Instance.new("TextButton")
  56. LocalScript38 = Instance.new("LocalScript")
  57. TextButton39 = Instance.new("TextButton")
  58. LocalScript40 = Instance.new("LocalScript")
  59. Script41 = Instance.new("Script")
  60. Script42 = Instance.new("Script")
  61. Part43 = Instance.new("Part")
  62. Part44 = Instance.new("Part")
  63. ManualWeld45 = Instance.new("ManualWeld")
  64. ManualWeld46 = Instance.new("ManualWeld")
  65. ManualWeld47 = Instance.new("ManualWeld")
  66. ManualWeld48 = Instance.new("ManualWeld")
  67. ManualWeld49 = Instance.new("ManualWeld")
  68. ManualWeld50 = Instance.new("ManualWeld")
  69. Configuration51 = Instance.new("Configuration")
  70. NumberValue52 = Instance.new("NumberValue")
  71. NumberValue53 = Instance.new("NumberValue")
  72. NumberValue54 = Instance.new("NumberValue")
  73. NumberValue55 = Instance.new("NumberValue")
  74. Part56 = Instance.new("Part")
  75. Trail57 = Instance.new("Trail")
  76. Model0.Name = "Tron"
  77. Model0.Parent = mas
  78. Model1.Parent = Model0
  79. Folder2.Name = "Variables"
  80. Folder2.Parent = Model1
  81. NumberValue3.Name = "Speed"
  82. NumberValue3.Parent = Folder2
  83. NumberValue4.Name = "turnSpeed"
  84. NumberValue4.Parent = Folder2
  85. MeshPart5.Parent = Model1
  86. MeshPart5.CFrame = CFrame.new(-7.15604019, 5.47103691, -1.07553101, 3.12638804e-13, 0.104528531, -0.99452126, 0, 0.994521677, 0.104528576, 0.999999583, -3.28626015e-14, 3.12638804e-13)
  87. MeshPart5.Orientation = Vector3.new(-6, -90, 0)
  88. MeshPart5.Position = Vector3.new(-7.15604019, 5.47103691, -1.07553101)
  89. MeshPart5.Rotation = Vector3.new(-90, -84, -90)
  90. MeshPart5.Color = Color3.new(0.388235, 0.372549, 0.384314)
  91. MeshPart5.Size = Vector3.new(2.90573525, 1.0300386, 3.35822749)
  92. MeshPart5.Anchored = true
  93. MeshPart5.BrickColor = BrickColor.new("Dark stone grey")
  94. MeshPart5.Material = Enum.Material.SmoothPlastic
  95. MeshPart5.brickColor = BrickColor.new("Dark stone grey")
  96. MeshPart6.Parent = Model1
  97. MeshPart6.CFrame = CFrame.new(-3.62510204, 7.81641388, -1.07467604, 2.34479103e-13, 0.765564382, -0.643345416, 6.7302355e-20, 0.643351197, 0.765571296, 0.999991, -1.77635684e-13, 1.52766688e-13)
  98. MeshPart6.Orientation = Vector3.new(-49.9599991, -90, 0)
  99. MeshPart6.Position = Vector3.new(-3.62510204, 7.81641388, -1.07467604)
  100. MeshPart6.Rotation = Vector3.new(-90, -40.0400009, -90)
  101. MeshPart6.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  102. MeshPart6.Size = Vector3.new(1.13391185, 1.53102779, 2.73461723)
  103. MeshPart6.Anchored = true
  104. MeshPart6.BrickColor = BrickColor.new("Really black")
  105. MeshPart6.Material = Enum.Material.SmoothPlastic
  106. MeshPart6.brickColor = BrickColor.new("Really black")
  107. MeshPart7.Parent = Model1
  108. MeshPart7.CFrame = CFrame.new(-9.85606003, 6.60482788, -1.07505, -3.12638804e-13, 0, -0.999999583, 0, -1, -0, -0.999999583, 0, 3.12638804e-13)
  109. MeshPart7.Orientation = Vector3.new(0, -90, 180)
  110. MeshPart7.Position = Vector3.new(-9.85606003, 6.60482788, -1.07505)
  111. MeshPart7.Rotation = Vector3.new(0, -89.9499969, -180)
  112. MeshPart7.Color = Color3.new(0.337255, 0.141176, 0.141176)
  113. MeshPart7.Size = Vector3.new(1.57169211, 0.735109806, 1.05706239)
  114. MeshPart7.Anchored = true
  115. MeshPart7.BrickColor = BrickColor.new("Cocoa")
  116. MeshPart7.Material = Enum.Material.Neon
  117. MeshPart7.brickColor = BrickColor.new("Cocoa")
  118. MeshPart8.Parent = Model1
  119. MeshPart8.CFrame = CFrame.new(-5.36166382, 6.05028105, -1.08328199, -3.12638804e-13, 3.2187252e-20, -0.999999583, -1.02323895e-07, -0.999999523, 0, -0.999999106, 1.02323853e-07, 3.12638804e-13)
  120. MeshPart8.Orientation = Vector3.new(0, -90, -180)
  121. MeshPart8.Position = Vector3.new(-5.36166382, 6.05028105, -1.08328199)
  122. MeshPart8.Rotation = Vector3.new(0, -89.9499969, -180)
  123. MeshPart8.Color = Color3.new(1, 0.666667, 0)
  124. MeshPart8.Size = Vector3.new(1.81559074, 3.1242187, 10.873642)
  125. MeshPart8.Anchored = true
  126. MeshPart8.BrickColor = BrickColor.new("Deep orange")
  127. MeshPart8.Material = Enum.Material.Neon
  128. MeshPart8.brickColor = BrickColor.new("Deep orange")
  129. MeshPart9.Parent = Model1
  130. MeshPart9.CFrame = CFrame.new(-5.35219193, 6.20050621, -1.075279, 9.1390838e-08, 0, 0.999999166, 0, 1, 0, -0.999999166, 0, 9.1390838e-08)
  131. MeshPart9.Orientation = Vector3.new(0, 90, 0)
  132. MeshPart9.Position = Vector3.new(-5.35219193, 6.20050621, -1.075279)
  133. MeshPart9.Rotation = Vector3.new(0, 89.9300003, 0)
  134. MeshPart9.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  135. MeshPart9.Size = Vector3.new(1.85247803, 3.45957899, 10.8464804)
  136. MeshPart9.Anchored = true
  137. MeshPart9.BrickColor = BrickColor.new("Really black")
  138. MeshPart9.Material = Enum.Material.SmoothPlastic
  139. MeshPart9.brickColor = BrickColor.new("Really black")
  140. VehicleSeat10.Parent = Model1
  141. VehicleSeat10.CFrame = CFrame.new(-6.32564211, 6.79579496, -1.00793505, -0.00378999859, 0.706787765, -0.707415581, 0.00378999859, 0.707425773, 0.706777513, 0.999985635, -2.41791054e-06, -0.00535986666)
  142. VehicleSeat10.Orientation = Vector3.new(-44.9700012, -90.4300003, 0.310000002)
  143. VehicleSeat10.Position = Vector3.new(-6.32564211, 6.79579496, -1.00793505)
  144. VehicleSeat10.Rotation = Vector3.new(-90.4300003, -45.0299988, -90.3099976)
  145. VehicleSeat10.Transparency = 1
  146. VehicleSeat10.MaxSpeed = 10
  147. VehicleSeat10.Size = Vector3.new(1.34000015, 0.200000003, 1)
  148. VehicleSeat10.Anchored = true
  149. VehicleSeat10.BottomSurface = Enum.SurfaceType.Smooth
  150. VehicleSeat10.TopSurface = Enum.SurfaceType.Smooth
  151. VehicleSeat10.HeadsUpDisplay = false
  152. Sound11.Name = "Boost"
  153. Sound11.Parent = VehicleSeat10
  154. Sound11.SoundId = "rbxassetid://278445103"
  155. Sound11.Volume = 1
  156. Sound12.Name = "Idle"
  157. Sound12.Parent = VehicleSeat10
  158. Sound12.Looped = true
  159. Sound12.SoundId = "rbxassetid://229396691"
  160. Sound12.Volume = 1
  161. Script13.Name = "LeanAnimator"
  162. Script13.Parent = VehicleSeat10
  163. table.insert(cors,sandbox(Script13,function()
  164. script.Parent.ChildAdded:connect(function(child)
  165. if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
  166. local P=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
  167. local S=script.L:Clone() S.Parent=P.PlayerGui
  168. S.Seat.Value=script.Parent
  169. S.Disabled=false
  170. end
  171. end)
  172. end))
  173. LocalScript14.Name = "L"
  174. LocalScript14.Parent = Script13
  175. table.insert(cors,sandbox(LocalScript14,function()
  176. script:WaitForChild("Seat")
  177. local C=game.Players.LocalPlayer.Character
  178. local S=script.Seat.Value
  179. local A=C.Animate
  180. local WS={}
  181. local HW={}
  182.  
  183. local LeanIn={
  184. CFrame.new(0, 1.14900017, 0.258000016, 1, -3.31787385e-016, 1.88165849e-015, 2.97155396e-022, 0.98480773, 0.173648193, -1.9106861e-015, -0.173648193, 0.98480773), --Torso
  185. CFrame.new(0, 1.49988317, -0.000556647778, 1, -4.76759258e-023, -3.2423824e-023, 4.46686114e-023, 0.99619472, -0.087155737, 3.64556732e-023, 0.087155737, 0.99619472), --Head
  186. CFrame.new(-1.43356705, 0.265303612, -0.707622886, 0.987688363, -0.156433478, 3.03756634e-023, 0.050929904, 0.321556747, -0.945509553, 0.147911251, 0.933868766, 0.325564921), --Larm
  187. CFrame.new(1.43356705, 0.265304089, -0.707622886, 0.987688363, 0.156433567, 4.2382986e-008, -0.0509298891, 0.321556747, -0.945509553, -0.14791134, 0.933868766, 0.325564921), --Rarm
  188. CFrame.new(-0.96213913, -1.80122519, -1.02161586, 0.992545903, -0.120017275, -0.0211622044, 0.121405296, 0.988874793, 0.0858653039, 0.0106216175, -0.0877945423, 0.996074677), --Lleg
  189. CFrame.new(0.96213913, -1.80122495, -1.02161658, 0.992545903, 0.12001726, 0.0211623125, -0.121405274, 0.988874793, 0.0858654827, -0.0106217042, -0.0877947211, 0.996074677) --Rleg
  190. }
  191.  
  192. local LeanRight={
  193. CFrame.new(0.298854828, 1.12325048, 0.26254034, 0.99619472, 0.087155737, 2.78333623e-009, -0.0858316422, 0.981060266, 0.173647776, 0.0151344389, -0.172987416, 0.984805346), --Torso
  194. CFrame.new(-0.0914306641, 1.53194857, 0.0491700768, 0.862327278, -0.194353044, -0.467576951, 0.125371307, 0.976608455, -0.174722731, 0.49059394, 0.0920472369, 0.866515875), --Head
  195. CFrame.new(-1.48981094, 0.115443468, -0.842987239, 0.993704081, 0.0759108514, 0.0824074224, 0.0527767465, 0.331662595, -0.941921234, -0.0988332182, 0.940336347, 0.325567663), --Larm
  196. CFrame.new(1.29483414, 0.303791523, -0.511669457, 0.960572422, 0.273474187, 0.0501292087, -0.00622838736, 0.201421723, -0.979485035, -0.277960151, 0.940551579, 0.195182949), --Rarm
  197. CFrame.new(-1.11898804, -1.88069582, -1.00439596, 0.974427938, -0.223244309, -0.0255650152, 0.224480718, 0.972204685, 0.0665403977, 0.00999965332, -0.0705775172, 0.997453749), --Lleg
  198. CFrame.new(1.15502548, -1.77824378, -0.932802498, 0.927668929, 0.372922808, -0.0189763606, -0.372866631, 0.927862644, 0.00654045027, 0.0200464074, 0.00100833306, 0.999797344) --Rleg
  199. }
  200. local LeanLeft={
  201. CFrame.new(-0.298854828, 1.12325048, 0.26254034, 0.99619472, -0.087155737, -2.783338e-009, 0.0858316422, 0.981060266, 0.173647776, -0.0151344389, -0.172987431, 0.984805346), --Torso
  202. CFrame.new(0.0914344788, 1.53194904, 0.0491700768, 0.862327337, 0.194353044, 0.467576921, -0.125371307, 0.976608455, -0.174722746, -0.49059394, 0.0920472294, 0.866515934), --Head
  203. CFrame.new(-1.29483414, 0.303792, -0.511669338, 0.960572362, -0.273474187, -0.0501292087, 0.00622837245, 0.201421723, -0.979485035, 0.277960181, 0.940551579, 0.195182949), --Larm
  204. CFrame.new(1.48981094, 0.115444183, -0.842987359, 0.993704081, -0.0759108514, -0.0824074224, -0.0527767465, 0.331662595, -0.941921234, 0.0988332108, 0.940336347, 0.325567663), --Rarm
  205. CFrame.new(-1.15502548, -1.77824354, -0.932802379, 0.927668929, -0.372922808, 0.0189763606, 0.37286666, 0.927862644, 0.00654044235, -0.0200464055, 0.00100832386, 0.999797344), --Lleg
  206. CFrame.new(1.11898804, -1.88069534, -1.00439596, 0.974427938, 0.223244309, 0.0255650133, -0.224480718, 0.972204685, 0.0665403903, -0.00999965239, -0.0705775023, 0.997453749) --Rleg
  207. }
  208.  
  209. local Idle={
  210. CFrame.new(0.566169739, 0.894453526, 0.302883625, 0.984807789, 0.173648164, -5.16676948e-007, -0.171010077, 0.96984601, 0.17364642, 0.030153539, -0.17101185, 0.984807968), --Torso
  211. CFrame.new(-0.138946533, 1.558671, -0.0179908276, 0.984807789, -0.172987387, 0.0151342805, 0.173648164, 0.981060147, -0.0858334228, -5.16676948e-007, 0.0871539414, 0.99619478), --Head
  212. CFrame.new(-1.59151077, 0.189359188, -0.726816714, 0.952456295, 0.258902967, 0.160618037, 0.0754599869, 0.310294151, -0.947641015, -0.295186609, 0.914704621, 0.276007742), --Larm
  213. CFrame.new(1.11422348, 0.44413662, -0.756388962, 0.885705829, 0.44919309, 0.117280558, 0.0694727823, 0.12153586, -0.990154266, -0.459024459, 0.885129809, 0.0764425397), --Rarm
  214. CFrame.new(-1.23868942, -1.78679085, -0.829940856, 0.956385612, -0.291406542, 0.0202232152, 0.291914225, 0.950942159, -0.10244558, 0.0106208036, 0.103877537, 0.99453336), --Lleg
  215. CFrame.new(1.40875244, -2.2126379, -0.607943952, 0.955117106, -0.284095228, 0.0839115456, 0.292021811, 0.950557053, -0.105662294, -0.0497459471, 0.125420481, 0.990855634) --Rleg
  216. }
  217.  
  218. S.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" then for i,v in pairs(WS) do if v~=0 then if v[4]~=nil then v[4]:Destroy() v[1].Part1=v[5] else if v[2]~=nil then v[1].C0=v[2] v[1].C1=v[3] else v[1]:Destroy() end end end end for i,v in pairs(HW) do v[1]:Destroy() v[2]:Destroy() v[3].Transparency=0 end A.Parent=C A.Disabled=false script:Destroy() end end)
  219. function MW(x,y)
  220. local WW=Instance.new("Weld",x) WW.Part0=x WW.Part1=y return WW
  221. end
  222.  
  223.  
  224. if C:FindFirstChild("HumanoidRootPart")~=nil and C:FindFirstChild("Torso")~=nil then
  225. A.Disabled=true
  226. A.Parent=script
  227. S.SeatWeld.C0=CFrame.new()
  228. S.SeatWeld.C1=CFrame.new()
  229. C.HumanoidRootPart.RootJoint.Part1=nil
  230. table.insert(WS,{C.HumanoidRootPart.RootJoint,C.HumanoidRootPart.RootJoint.C0,C.HumanoidRootPart.RootJoint.C1,MW(C.HumanoidRootPart,C.Torso),C.Torso})
  231. if C.Torso:FindFirstChild("Neck")~=nil then
  232. local H=C.Head:Clone()
  233. H.Parent=S.Parent
  234. local WH=MW(C.Torso,H)
  235. WH.C0=C.Torso.Neck.C0
  236. WH.C1=C.Torso.Neck.C0
  237. C.Head.Transparency=1
  238. table.insert(HW,{H,WH,C.Head})
  239. table.insert(WS,{WH,nil,nil,nil,nil})
  240. for i,v in pairs(C.Head:GetChildren()) do
  241. if v:IsA("Weld") then
  242. local pp=v.Part1:Clone()
  243. pp.Parent=S.Parent
  244. v.Part1.Transparency=1
  245. local ww=MW(H,pp)
  246. ww.C0=v.C0
  247. ww.C1=v.C1
  248. table.insert(HW,{pp,ww,v.Part1})
  249. end
  250. end
  251. else
  252. table.insert(WS,0)
  253. end
  254. if C.Torso:FindFirstChild("Left Shoulder")~=nil then
  255. C.Torso:FindFirstChild("Left Shoulder").Part1=nil
  256. table.insert(WS,{C.Torso:FindFirstChild("Left Shoulder"),C.Torso:FindFirstChild("Left Shoulder").C0,C.Torso:FindFirstChild("Left Shoulder").C1,MW(C.Torso,C:FindFirstChild("Left Arm")),C:FindFirstChild("Left Arm")})
  257. else
  258. table.insert(WS,0)
  259. end
  260. if C.Torso:FindFirstChild("Right Shoulder")~=nil then
  261. C.Torso:FindFirstChild("Right Shoulder").Part1=nil
  262. table.insert(WS,{C.Torso:FindFirstChild("Right Shoulder"),C.Torso:FindFirstChild("Right Shoulder").C0,C.Torso:FindFirstChild("Right Shoulder").C1,MW(C.Torso,C:FindFirstChild("Right Arm")),C:FindFirstChild("Right Arm")})
  263. else
  264. table.insert(WS,0)
  265. end
  266. if C.Torso:FindFirstChild("Left Hip")~=nil then
  267. C.Torso:FindFirstChild("Left Hip").Part1=nil
  268. table.insert(WS,{C.Torso:FindFirstChild("Left Hip"),C.Torso:FindFirstChild("Left Hip").C0,C.Torso:FindFirstChild("Left Hip").C1,MW(C.Torso,C:FindFirstChild("Left Leg")),C:FindFirstChild("Left Leg")})
  269. else
  270. table.insert(WS,0)
  271. end
  272. if C.Torso:FindFirstChild("Right Hip")~=nil then
  273. C.Torso:FindFirstChild("Right Hip").Part1=nil
  274. table.insert(WS,{C.Torso:FindFirstChild("Right Hip"),C.Torso:FindFirstChild("Right Hip").C0,C.Torso:FindFirstChild("Right Hip").C1,MW(C.Torso,C:FindFirstChild("Right Leg")),C:FindFirstChild("Right Leg")})
  275. else
  276. table.insert(WS,0)
  277. end
  278. end
  279.  
  280. for i,v in pairs(WS) do
  281. if v[4]~=nil then
  282. v[4].C0=LeanIn[i]
  283. v[4].C1=CFrame.new()
  284. else
  285. v[1].C0=LeanIn[i]
  286. v[1].C1=CFrame.new()
  287. end
  288. end
  289.  
  290. function getC(w,c)
  291. local ax,ay,az,ar00,ar01,ar02,ar10,ar11,ar12,ar20,ar21,ar22=CFrame.new().components(w.C0)
  292. local bx,by,bz,br00,br01,br02,br10,ar11,br12,br20,br21,br22=CFrame.new().components(c)
  293. local ca={ax,ay,az,ar00,ar01,ar02,ar10,ar11,ar12,ar20,ar21,ar22}
  294. local cb={bx,by,bz,br00,br01,br02,br10,ar11,br12,br20,br21,br22}
  295. local cd={}
  296. for i,v in pairs(ca) do
  297. table.insert(cd,(cb[i]-v)/10)
  298. end
  299. return cd
  300. end
  301. function tween(w,cd)
  302. local cx,cy,cz,cr00,cr01,cr02,cr10,cr11,cr12,cr20,cr21,cr22=CFrame.new().components(w.C0)
  303. local cc={cx,cy,cz,cr00,cr01,cr02,cr10,cr11,cr12,cr20,cr21,cr22}
  304. local ce={}
  305. for i,v in pairs(cc) do
  306. table.insert(ce,v+cd[i])
  307. end
  308. w.C0=CFrame.new(ce[1],ce[2],ce[3],ce[4],ce[5],ce[6],ce[7],ce[8],ce[9],ce[10],ce[11],ce[12])
  309. end
  310. function setPose(p)
  311. for i,v in pairs(WS) do
  312. if v[4]~=nil then
  313. tween(v[4],p[i])
  314. else
  315. tween(v[1],p[i])
  316. end
  317. end
  318. end
  319. function getPose(p)
  320. local ps={}
  321. for i,v in pairs(WS) do
  322. if v[4]~=nil then
  323. table.insert(ps,getC(v[4],p[i]))
  324. else
  325. table.insert(ps,getC(v[1],p[i]))
  326. end
  327. end
  328. return(ps)
  329. end
  330.  
  331. local steer=S.Steer
  332. local idling=false
  333. local frame=0
  334. pose=getPose(LeanIn)
  335. while wait() do
  336. if S.Velocity.Magnitude<3 and not idling then
  337. idling=true
  338. frame=0
  339. pose=getPose(Idle)
  340. else
  341. if S.Velocity.Magnitude>3 and (S.Steer~=steer or idling==true) then
  342. steer=S.Steer
  343. frame=0
  344. if steer==0 then
  345. pose=getPose(LeanIn)
  346. elseif steer==1 then
  347. pose=getPose(LeanRight)
  348. else
  349. pose=getPose(LeanLeft)
  350. end
  351. idling=false
  352. end
  353. end
  354. if frame<10 then
  355. frame=frame+1
  356. setPose(pose)
  357. end
  358. end
  359. end))
  360. LocalScript14.Disabled = true
  361. ObjectValue15.Name = "Seat"
  362. ObjectValue15.Parent = LocalScript14
  363. BodyAngularVelocity16.Name = "angv"
  364. BodyAngularVelocity16.Parent = VehicleSeat10
  365. BodyAngularVelocity16.AngularVelocity = Vector3.new(0, 0, 0)
  366. BodyAngularVelocity16.MaxTorque = Vector3.new(1e+09, 1e+09, 1e+09)
  367. BodyAngularVelocity16.angularvelocity = Vector3.new(0, 0, 0)
  368. BodyAngularVelocity16.maxTorque = Vector3.new(1e+09, 1e+09, 1e+09)
  369. BodyGyro17.Name = "gy"
  370. BodyGyro17.Parent = VehicleSeat10
  371. BodyGyro17.MaxTorque = Vector3.new(0, 0, 1e+10)
  372. BodyGyro17.maxTorque = Vector3.new(0, 0, 1e+10)
  373. BodyGyro17.D = 250
  374. BodyVelocity18.Name = "vel"
  375. BodyVelocity18.Parent = VehicleSeat10
  376. BodyVelocity18.MaxForce = Vector3.new(99999, 0, 99999)
  377. BodyVelocity18.maxForce = Vector3.new(99999, 0, 99999)
  378. BodyVelocity18.Velocity = Vector3.new(0, 0, 0)
  379. BodyVelocity18.velocity = Vector3.new(0, 0, 0)
  380. Script19.Name = "Engine"
  381. Script19.Parent = VehicleSeat10
  382. table.insert(cors,sandbox(Script19,function()
  383. local vUpdate=require(script:WaitForChild("VehicleUpdater"))
  384.  
  385. local player=nil
  386.  
  387. script.Parent.ChildAdded:connect(function(v)
  388. if v:IsA("Weld") and v.Name=="SeatWeld" then --Hey, players use this to sit!
  389. player=game.Players:GetPlayerFromCharacter(v.Part1.Parent)
  390. if player then --WE GOT ONE!!!
  391. script.VControls:Clone().Parent=player.PlayerGui
  392. end
  393. end
  394. end)
  395. script.Parent.ChildRemoved:connect(function(v)
  396. if v:IsA("Weld") and v.Name=="SeatWeld" and player then
  397. local scr=player.PlayerGui:FindFirstChild("VControls")
  398. if scr then scr:Destroy() end
  399. end
  400. end)
  401. end))
  402. LocalScript20.Name = "VControls"
  403. LocalScript20.Parent = Script19
  404. table.insert(cors,sandbox(LocalScript20,function()
  405. local pl=game.Players.LocalPlayer
  406. local cam=workspace.CurrentCamera
  407. local seat=cam.CameraSubject
  408. local vehicle=seat.Parent
  409.  
  410.  
  411. local vUpdate=require(seat.Engine:FindFirstChild("VehicleUpdater"))
  412. print('VEHICLE CONTROL INITIALIZED.')
  413. print('DRIVER NAME: '.. pl.Name)
  414. print('VEHICLE NAME: '.. vehicle.Name)
  415.  
  416. while wait() do
  417. vUpdate(pl,vehicle)
  418. end
  419. end))
  420. ModuleScript21.Name = "VehicleUpdater"
  421. ModuleScript21.Parent = Script19
  422. table.insert(cors,sandbox(ModuleScript21,function()
  423. local handling = ( 2 ) *.05;
  424. local maxTurn = ( 4 );
  425. local acceleration = ( 2 ) *.05;
  426. local topSpeed = ( 5 ) +250;
  427.  
  428. local visualTorque = ( 5 ) *.1
  429.  
  430. local boospeed=0
  431. local debounce=false
  432. local zoomin=false
  433.  
  434. local function explode(p)
  435. local e=Instance.new("Fire")
  436. e.Parent=workspace
  437. end
  438.  
  439. local function boost(boospe,vel,seat,cam)
  440. local boostSound=seat.Boost
  441. boostSound:Play()
  442.  
  443. debounce=true
  444. zoomin=true
  445. for i=1,15 do
  446. cam.FieldOfView=(60-cam.FieldOfView)*.1+cam.FieldOfView
  447. game:GetService("RunService").RenderStepped:wait()
  448. end
  449. --boostCharge:Stop()
  450. --boostSound:Play()
  451. explode(seat.CFrame.p)
  452. zoomin=false
  453. boospeed=boospe
  454. vel.velocity=vel.velocity+seat.CFrame.lookVector*boospe
  455. cam.FieldOfView=100
  456. wait(.1)
  457. debounce=false
  458. end
  459.  
  460. return function(player,vehicle)
  461. local cam=workspace.CurrentCamera
  462.  
  463. local seat=vehicle:FindFirstChild("VehicleSeat")
  464.  
  465. local angv=seat:FindFirstChild("angv")
  466. local vel=seat:FindFirstChild("vel")
  467. local gyro=seat:FindFirstChild("gy")
  468.  
  469. local variables=vehicle:FindFirstChild("Variables")
  470. local speed=variables.Speed
  471.  
  472. --Control
  473. if seat.Steer~=0 then
  474. variables.turnSpeed.Value=maxTurn*seat.Steer
  475. else
  476. variables.turnSpeed.Value=0
  477. end
  478. if seat.Throttle==1 then
  479. speed.Value=topSpeed+boospeed
  480. elseif seat.Throttle==-1 then
  481. speed.Value=-topSpeed/2-boospeed
  482. else
  483. speed.Value=0
  484. end
  485.  
  486. --Update
  487. local idle=seat.Idle
  488. if not idle.IsPlaying then idle:Play() end
  489. idle.Pitch=.3+(vel.velocity.Magnitude/topSpeed)
  490.  
  491. local lv=seat.CFrame.lookVector
  492. local roll=(-angv.angularvelocity.y/maxTurn)*((vel.velocity.Magnitude/topSpeed)*.7+.3)
  493.  
  494. vel.velocity=vel.velocity:Lerp(lv*variables.Speed.Value,acceleration)
  495. angv.angularvelocity=angv.angularvelocity:Lerp(Vector3.new(0,-variables.turnSpeed.Value,0),handling)
  496. gyro.cframe=CFrame.fromAxisAngle(lv,roll)
  497.  
  498. if boospeed<=0 then boospeed=0 else boospeed=boospeed-1 end
  499. if zoomin==false then cam.FieldOfView=(70-cam.FieldOfView)*.05+cam.FieldOfView end
  500.  
  501. cam.CameraType="Track"
  502.  
  503. --Check for boosters or hazards
  504. vehicle:FindFirstChild("GyroBall").Touched:connect(function(p)
  505. if p.Name=="Boost" and debounce==false then boost(50,vel,seat,cam) end
  506. end)
  507. end
  508. end))
  509. ScreenGui22.Name = "CAMERACONTROL"
  510. ScreenGui22.Parent = VehicleSeat10
  511. ObjectValue23.Name = "CarSeat"
  512. ObjectValue23.Parent = ScreenGui22
  513. Frame24.Name = "SPDCTR"
  514. Frame24.Parent = ScreenGui22
  515. Frame24.Position = UDim2.new(1, -275, 1, -60)
  516. Frame24.Size = UDim2.new(0, 106, 0, 50)
  517. Frame24.Active = true
  518. Frame24.BackgroundColor = BrickColor.new("Institutional white")
  519. Frame24.BackgroundColor3 = Color3.new(1, 1, 1)
  520. Frame24.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  521. Frame24.Draggable = true
  522. Frame24.Style = Enum.FrameStyle.RobloxRound
  523. TextLabel25.Name = "sps"
  524. TextLabel25.Parent = Frame24
  525. TextLabel25.Position = UDim2.new(1, -27, 0.5, 0)
  526. TextLabel25.BackgroundColor = BrickColor.new("Institutional white")
  527. TextLabel25.BackgroundColor3 = Color3.new(1, 1, 1)
  528. TextLabel25.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  529. TextLabel25.BorderSizePixel = 0
  530. TextLabel25.Font = Enum.Font.SourceSansBold
  531. TextLabel25.FontSize = Enum.FontSize.Size24
  532. TextLabel25.Text = "sps"
  533. TextLabel25.TextColor = BrickColor.new("Pearl")
  534. TextLabel25.TextColor3 = Color3.new(0.901961, 0.901961, 0.901961)
  535. TextLabel25.TextSize = 24
  536. TextLabel25.TextStrokeTransparency = 0
  537. TextLabel25.TextXAlignment = Enum.TextXAlignment.Left
  538. TextLabel26.Name = "NUMBER"
  539. TextLabel26.Parent = Frame24
  540. TextLabel26.Position = UDim2.new(0, 60, 1, -20)
  541. TextLabel26.BackgroundColor = BrickColor.new("Institutional white")
  542. TextLabel26.BackgroundColor3 = Color3.new(1, 1, 1)
  543. TextLabel26.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  544. TextLabel26.BorderSizePixel = 0
  545. TextLabel26.Font = Enum.Font.SourceSans
  546. TextLabel26.FontSize = Enum.FontSize.Size48
  547. TextLabel26.Text = "999"
  548. TextLabel26.TextColor = BrickColor.new("Pearl")
  549. TextLabel26.TextColor3 = Color3.new(0.901961, 0.901961, 0.901961)
  550. TextLabel26.TextSize = 48
  551. TextLabel26.TextStrokeTransparency = 0
  552. TextLabel26.TextXAlignment = Enum.TextXAlignment.Right
  553. LocalScript27.Parent = TextLabel26
  554. table.insert(cors,sandbox(LocalScript27,function()
  555. local seat = script.Parent.Parent.Parent.CarSeat.Value
  556.  
  557. while wait(0.1) do
  558. if seat == nil then wait(1) -- we won't break if the value returns nil
  559. else script.Parent.Text = math.floor(seat.Velocity.Magnitude)
  560. end
  561. end
  562. end))
  563. Frame28.Name = "CONTAINER"
  564. Frame28.Parent = ScreenGui22
  565. Frame28.Position = UDim2.new(1, -250, 1, -180)
  566. Frame28.Visible = false
  567. Frame28.Size = UDim2.new(0, 200, 0, 120)
  568. Frame28.Active = true
  569. Frame28.BackgroundColor = BrickColor.new("Institutional white")
  570. Frame28.BackgroundColor3 = Color3.new(1, 1, 1)
  571. Frame28.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  572. Frame28.Style = Enum.FrameStyle.RobloxRound
  573. TextLabel29.Name = "Label"
  574. TextLabel29.Parent = Frame28
  575. TextLabel29.Position = UDim2.new(0, 2, 0.5, -2)
  576. TextLabel29.Rotation = -90
  577. TextLabel29.BackgroundColor = BrickColor.new("Institutional white")
  578. TextLabel29.BackgroundColor3 = Color3.new(1, 1, 1)
  579. TextLabel29.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  580. TextLabel29.BorderSizePixel = 0
  581. TextLabel29.Font = Enum.Font.SourceSansBold
  582. TextLabel29.FontSize = Enum.FontSize.Size24
  583. TextLabel29.Text = "Camera"
  584. TextLabel29.TextColor = BrickColor.new("Institutional white")
  585. TextLabel29.TextColor3 = Color3.new(1, 1, 1)
  586. TextLabel29.TextSize = 24
  587. TextLabel29.TextStrokeTransparency = 0
  588. TextButton30.Name = "ATTACH"
  589. TextButton30.Parent = Frame28
  590. TextButton30.Position = UDim2.new(0, 25, 0, 0)
  591. TextButton30.Size = UDim2.new(0, 70, 0, 30)
  592. TextButton30.BackgroundColor = BrickColor.new("Institutional white")
  593. TextButton30.BackgroundColor3 = Color3.new(1, 1, 1)
  594. TextButton30.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  595. TextButton30.Style = Enum.ButtonStyle.RobloxButton
  596. TextButton30.Font = Enum.Font.SourceSans
  597. TextButton30.FontSize = Enum.FontSize.Size18
  598. TextButton30.Text = "Attach"
  599. TextButton30.TextColor = BrickColor.new("Institutional white")
  600. TextButton30.TextColor3 = Color3.new(1, 1, 1)
  601. TextButton30.TextSize = 18
  602. LocalScript31.Name = "CamScript"
  603. LocalScript31.Parent = TextButton30
  604. table.insert(cors,sandbox(LocalScript31,function()
  605. local cam = Workspace.CurrentCamera
  606.  
  607. function ChangeCameraFP() -- scroll in for this one
  608. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  609. cam.CameraType = "Attach"
  610. end
  611.  
  612. function onButtonClicked()
  613. ChangeCameraFP()
  614. end
  615. script.Parent.MouseButton1Down:connect(onButtonClicked)
  616. end))
  617. TextButton32.Name = "FOLLOW"
  618. TextButton32.Parent = Frame28
  619. TextButton32.Position = UDim2.new(1, -80, 0, 0)
  620. TextButton32.Size = UDim2.new(0, 70, 0, 30)
  621. TextButton32.BackgroundColor = BrickColor.new("Institutional white")
  622. TextButton32.BackgroundColor3 = Color3.new(1, 1, 1)
  623. TextButton32.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  624. TextButton32.Style = Enum.ButtonStyle.RobloxButton
  625. TextButton32.Font = Enum.Font.SourceSans
  626. TextButton32.FontSize = Enum.FontSize.Size18
  627. TextButton32.Text = "Follow"
  628. TextButton32.TextColor = BrickColor.new("Institutional white")
  629. TextButton32.TextColor3 = Color3.new(1, 1, 1)
  630. TextButton32.TextSize = 18
  631. LocalScript33.Name = "CamScript"
  632. LocalScript33.Parent = TextButton32
  633. table.insert(cors,sandbox(LocalScript33,function()
  634. local cam = Workspace.CurrentCamera
  635.  
  636. function ChangeCameraTPF()
  637. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  638. cam.CameraType = "Follow"
  639. end
  640.  
  641. function onButtonClicked()
  642. ChangeCameraTPF()
  643. end
  644. script.Parent.MouseButton1Down:connect(onButtonClicked)
  645. end))
  646. TextButton34.Name = "FOVUP"
  647. TextButton34.Parent = Frame28
  648. TextButton34.Position = UDim2.new(1, -45, 1, -34)
  649. TextButton34.Size = UDim2.new(0, 30, 0, 30)
  650. TextButton34.BackgroundColor = BrickColor.new("Institutional white")
  651. TextButton34.BackgroundColor3 = Color3.new(1, 1, 1)
  652. TextButton34.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  653. TextButton34.Style = Enum.ButtonStyle.RobloxButton
  654. TextButton34.Font = Enum.Font.SourceSans
  655. TextButton34.FontSize = Enum.FontSize.Size18
  656. TextButton34.Text = "+"
  657. TextButton34.TextColor = BrickColor.new("Institutional white")
  658. TextButton34.TextColor3 = Color3.new(1, 1, 1)
  659. TextButton34.TextSize = 18
  660. LocalScript35.Name = "CamScript"
  661. LocalScript35.Parent = TextButton34
  662. table.insert(cors,sandbox(LocalScript35,function()
  663. local cam = Workspace.CurrentCamera
  664.  
  665. function ChangeFOVUp()
  666. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  667. cam.FieldOfView = cam.FieldOfView + 10
  668. script.Parent.Parent.FOVNO.Text = tostring("FOV: "..math.floor(cam.FieldOfView))
  669. end
  670.  
  671. function onButtonClicked()
  672. ChangeFOVUp()
  673. end
  674. script.Parent.MouseButton1Down:connect(onButtonClicked)
  675. end))
  676. TextLabel36.Name = "FOVNO"
  677. TextLabel36.Parent = Frame28
  678. TextLabel36.Position = UDim2.new(0.5, 5, 1, -20)
  679. TextLabel36.BackgroundColor = BrickColor.new("Institutional white")
  680. TextLabel36.BackgroundColor3 = Color3.new(1, 1, 1)
  681. TextLabel36.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  682. TextLabel36.BorderSizePixel = 0
  683. TextLabel36.Font = Enum.Font.SourceSans
  684. TextLabel36.FontSize = Enum.FontSize.Size18
  685. TextLabel36.Text = "FOV: 70"
  686. TextLabel36.TextColor = BrickColor.new("Institutional white")
  687. TextLabel36.TextColor3 = Color3.new(1, 1, 1)
  688. TextLabel36.TextSize = 18
  689. TextLabel36.TextStrokeTransparency = 0
  690. TextButton37.Name = "FOVDN"
  691. TextButton37.Parent = Frame28
  692. TextButton37.Position = UDim2.new(0.5, -67, 1, -34)
  693. TextButton37.Size = UDim2.new(0, 30, 0, 30)
  694. TextButton37.BackgroundColor = BrickColor.new("Institutional white")
  695. TextButton37.BackgroundColor3 = Color3.new(1, 1, 1)
  696. TextButton37.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  697. TextButton37.Style = Enum.ButtonStyle.RobloxButton
  698. TextButton37.Font = Enum.Font.SourceSans
  699. TextButton37.FontSize = Enum.FontSize.Size18
  700. TextButton37.Text = "-"
  701. TextButton37.TextColor = BrickColor.new("Institutional white")
  702. TextButton37.TextColor3 = Color3.new(1, 1, 1)
  703. TextButton37.TextSize = 18
  704. LocalScript38.Name = "CamScript"
  705. LocalScript38.Parent = TextButton37
  706. table.insert(cors,sandbox(LocalScript38,function()
  707. local cam = Workspace.CurrentCamera
  708.  
  709. function ChangeFOVUp()
  710. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  711. cam.FieldOfView = cam.FieldOfView - 10
  712. script.Parent.Parent.FOVNO.Text = tostring("FOV: "..math.floor(cam.FieldOfView))
  713. end
  714.  
  715. function onButtonClicked()
  716. ChangeFOVUp()
  717. end
  718. script.Parent.MouseButton1Down:connect(onButtonClicked)
  719. end))
  720. TextButton39.Name = "TRACK"
  721. TextButton39.Parent = Frame28
  722. TextButton39.Position = UDim2.new(0, 25, 0, 35)
  723. TextButton39.Size = UDim2.new(0, 70, 0, 30)
  724. TextButton39.BackgroundColor = BrickColor.new("Institutional white")
  725. TextButton39.BackgroundColor3 = Color3.new(1, 1, 1)
  726. TextButton39.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  727. TextButton39.Style = Enum.ButtonStyle.RobloxButton
  728. TextButton39.Font = Enum.Font.SourceSans
  729. TextButton39.FontSize = Enum.FontSize.Size18
  730. TextButton39.Text = "Track"
  731. TextButton39.TextColor = BrickColor.new("Institutional white")
  732. TextButton39.TextColor3 = Color3.new(1, 1, 1)
  733. TextButton39.TextSize = 18
  734. LocalScript40.Name = "CamScript"
  735. LocalScript40.Parent = TextButton39
  736. table.insert(cors,sandbox(LocalScript40,function()
  737. local cam = Workspace.CurrentCamera
  738.  
  739. function ChangeCameraTPF()
  740. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  741. cam.CameraType = "Track"
  742. end
  743.  
  744. function onButtonClicked()
  745. ChangeCameraTPF()
  746. end
  747. script.Parent.MouseButton1Down:connect(onButtonClicked)
  748. end))
  749. Script41.Name = "Gui Giver"
  750. Script41.Parent = VehicleSeat10
  751. table.insert(cors,sandbox(Script41,function()
  752. GUI = script.Parent.CAMERACONTROL
  753.  
  754. script.Parent.ChildAdded:connect(function(child)
  755. if child:IsA("Weld") then
  756. --child.C0 = CFrame.new(-1.4,-1.3,0.2)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
  757. if child.Part1.Name == "HumanoidRootPart" then
  758. player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
  759. if player and (not player.PlayerGui:FindFirstChild("CAMERACONTROL")) then --// The part after the "and" prevents multiple GUI's to be copied over.
  760. GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
  761. GUI:Clone().Parent = player.PlayerGui --// Compact version
  762. end
  763. end
  764. end
  765. end)
  766.  
  767. script.Parent.ChildRemoved:connect(function(child)
  768. if child:IsA("Weld") then
  769. if child.Part1.Name == "HumanoidRootPart" then
  770. player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
  771. if player and player.PlayerGui:FindFirstChild("CAMERACONTROL") then
  772. player.PlayerGui:FindFirstChild("CAMERACONTROL"):Destroy()
  773. end
  774. end
  775. end
  776. end)
  777.  
  778.  
  779. end))
  780. Script42.Name = "qPerfectionWeld"
  781. Script42.Parent = Model1
  782. table.insert(cors,sandbox(Script42,function()
  783. -- Created by Quenty (@Quenty, follow me on twitter).
  784. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  785. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  786.  
  787. --[[ INSTRUCTIONS
  788. - Place in the model
  789. - Make sure model is anchored
  790. - That's it. It will weld the model and all children.
  791.  
  792. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  793. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  794. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  795. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  796. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  797. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  798. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  799. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  800.  
  801. 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.
  802. ]]
  803.  
  804. --[[ DOCUMENTATION
  805. - 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.
  806. - Will work in PBS servers
  807. - Will work as long as it starts out with the part anchored
  808. - Stores the relative CFrame as a CFrame value
  809. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  810. - Utilizes a recursive algorith to find all parts in the model
  811. - Will reweld on script reparent if the script is initially parented to a tool.
  812. - Welds as fast as possible
  813. ]]
  814.  
  815. -- qPerfectionWeld.lua
  816. -- Created 10/6/2014
  817. -- Author: Quenty
  818. -- Version 1.0.3
  819.  
  820. -- Updated 10/14/2014 - Updated to 1.0.1
  821. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  822.  
  823. -- Updated 10/14/2014 - Updated to 1.0.2
  824. --- Fixed bug fix.
  825.  
  826. -- Updated 10/14/2014 - Updated to 1.0.3
  827. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  828.  
  829. 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).
  830.  
  831.  
  832. local function CallOnChildren(Instance, FunctionToCall)
  833. -- Calls a function on each of the children of a certain object, using recursion.
  834.  
  835. FunctionToCall(Instance)
  836.  
  837. for _, Child in next, Instance:GetChildren() do
  838. CallOnChildren(Child, FunctionToCall)
  839. end
  840. end
  841.  
  842. local function GetNearestParent(Instance, ClassName)
  843. -- Returns the nearest parent of a certain class, or returns nil
  844.  
  845. local Ancestor = Instance
  846. repeat
  847. Ancestor = Ancestor.Parent
  848. if Ancestor == nil then
  849. return nil
  850. end
  851. until Ancestor:IsA(ClassName)
  852.  
  853. return Ancestor
  854. end
  855.  
  856. local function GetBricks(StartInstance)
  857. local List = {}
  858.  
  859. -- if StartInstance:IsA("BasePart") then
  860. -- List[#List+1] = StartInstance
  861. -- end
  862.  
  863. CallOnChildren(StartInstance, function(Item)
  864. if Item:IsA("BasePart") then
  865. List[#List+1] = Item;
  866. end
  867. end)
  868.  
  869. return List
  870. end
  871.  
  872. local function Modify(Instance, Values)
  873. -- Modifies an Instance by using a table.
  874.  
  875. assert(type(Values) == "table", "Values is not a table");
  876.  
  877. for Index, Value in next, Values do
  878. if type(Index) == "number" then
  879. Value.Parent = Instance
  880. else
  881. Instance[Index] = Value
  882. end
  883. end
  884. return Instance
  885. end
  886.  
  887. local function Make(ClassType, Properties)
  888. -- Using a syntax hack to create a nice way to Make new items.
  889.  
  890. return Modify(Instance.new(ClassType), Properties)
  891. end
  892.  
  893. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  894. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  895.  
  896. local function HasWheelJoint(Part)
  897. for _, SurfaceName in pairs(Surfaces) do
  898. for _, HingSurfaceName in pairs(HingSurfaces) do
  899. if Part[SurfaceName].Name == HingSurfaceName then
  900. return true
  901. end
  902. end
  903. end
  904.  
  905. return false
  906. end
  907.  
  908. local function ShouldBreakJoints(Part)
  909. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  910. -- definitely some edge cases.
  911.  
  912. if NEVER_BREAK_JOINTS then
  913. return false
  914. end
  915.  
  916. if HasWheelJoint(Part) then
  917. return false
  918. end
  919.  
  920. local Connected = Part:GetConnectedParts()
  921.  
  922. if #Connected == 1 then
  923. return false
  924. end
  925.  
  926. for _, Item in pairs(Connected) do
  927. if HasWheelJoint(Item) then
  928. return false
  929. elseif not Item:IsDescendantOf(script.Parent) then
  930. return false
  931. end
  932. end
  933.  
  934. return true
  935. end
  936.  
  937. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  938. --- Weld's 2 parts together
  939. -- @param Part0 The first part
  940. -- @param Part1 The second part (Dependent part most of the time).
  941. -- @param [JointType] The type of joint. Defaults to weld.
  942. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  943. -- @return The weld created.
  944.  
  945. JointType = JointType or "Weld"
  946. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  947.  
  948. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  949. Modify(NewWeld, {
  950. Name = "qCFrameWeldThingy";
  951. Part0 = Part0;
  952. Part1 = Part1;
  953. C0 = CFrame.new();--Part0.CFrame:inverse();
  954. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  955. Parent = Part1;
  956. })
  957.  
  958. if not RelativeValue then
  959. RelativeValue = Make("CFrameValue", {
  960. Parent = Part1;
  961. Name = "qRelativeCFrameWeldValue";
  962. Archivable = true;
  963. Value = NewWeld.C1;
  964. })
  965. end
  966.  
  967. return NewWeld
  968. end
  969.  
  970. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  971. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  972. -- @param MainPart The part to weld the model to (can be in the model).
  973. -- @param [JointType] The type of joint. Defaults to weld.
  974. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  975.  
  976. for _, Part in pairs(Parts) do
  977. if ShouldBreakJoints(Part) then
  978. Part:BreakJoints()
  979. end
  980. end
  981.  
  982. for _, Part in pairs(Parts) do
  983. if Part ~= MainPart then
  984. WeldTogether(MainPart, Part, JointType, MainPart)
  985. end
  986. end
  987.  
  988. if not DoNotUnanchor then
  989. for _, Part in pairs(Parts) do
  990. Part.Anchored = false
  991. end
  992. MainPart.Anchored = false
  993. end
  994. end
  995.  
  996. local function PerfectionWeld()
  997. local Tool = GetNearestParent(script, "Tool")
  998.  
  999. local Parts = GetBricks(script.Parent)
  1000. 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]
  1001.  
  1002. if PrimaryPart then
  1003. WeldParts(Parts, PrimaryPart, "Weld", false)
  1004. else
  1005. warn("qWeld - Unable to weld part")
  1006. end
  1007.  
  1008. return Tool
  1009. end
  1010.  
  1011. local Tool = PerfectionWeld()
  1012.  
  1013.  
  1014. if Tool and script.ClassName == "Script" then
  1015. --- Don't bother with local scripts
  1016.  
  1017. script.Parent.AncestryChanged:connect(function()
  1018. PerfectionWeld()
  1019. end)
  1020. end
  1021.  
  1022. -- Created by Quenty (@Quenty, follow me on twitter).
  1023.  
  1024. end))
  1025. Part43.Name = "GyroBall"
  1026. Part43.Parent = Model1
  1027. Part43.CFrame = CFrame.new(-7.02035904, 5.3504982, -1.05673206, -0.000316999998, -0.000441999873, -0.999999881, 0, 0.999999881, -0.000441999931, 1, -1.40113983e-07, -0.000316999969)
  1028. Part43.Orientation = Vector3.new(0.0299999993, -90.0199966, 0)
  1029. Part43.Position = Vector3.new(-7.02035904, 5.3504982, -1.05673206)
  1030. Part43.Rotation = Vector3.new(125.650002, -89.9700012, 125.650002)
  1031. Part43.Transparency = 1
  1032. Part43.Size = Vector3.new(1.65000021, 1.65000021, 1.65000021)
  1033. Part43.Anchored = true
  1034. Part43.BottomSurface = Enum.SurfaceType.Smooth
  1035. Part43.CanCollide = false
  1036. Part43.CustomPhysicalProperties = 0.699999988, 0, 0, 1, 1
  1037. Part43.Elasticity = 0
  1038. Part43.Friction = 0
  1039. Part43.FrontSurface = Enum.SurfaceType.Hinge
  1040. Part43.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  1041. Part43.FormFactor = Enum.FormFactor.Symmetric
  1042. Part43.formFactor = Enum.FormFactor.Symmetric
  1043. Part43.Shape = Enum.PartType.Ball
  1044. Part44.Name = "Kart"
  1045. Part44.Parent = Model1
  1046. Part44.CFrame = CFrame.new(-6.81555176, 6.86030388, -0.908913016, -3.12638804e-13, -0.999999583, -0.000404999824, 0, -0.000404999999, 1, -0.999999583, 3.12638804e-13, 1.28369537e-16)
  1047. Part44.Orientation = Vector3.new(-90, 90, 0)
  1048. Part44.Position = Vector3.new(-6.81555176, 6.86030388, -0.908913016)
  1049. Part44.Rotation = Vector3.new(-90, -0.0199999996, 90)
  1050. Part44.Color = Color3.new(0.960784, 0.803922, 0.188235)
  1051. Part44.Transparency = 1
  1052. Part44.Size = Vector3.new(0.84799999, 3.39519978, 1.2579999)
  1053. Part44.Anchored = true
  1054. Part44.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  1055. Part44.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  1056. Part44.BrickColor = BrickColor.new("Bright yellow")
  1057. Part44.CanCollide = false
  1058. Part44.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  1059. Part44.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  1060. Part44.Material = Enum.Material.SmoothPlastic
  1061. Part44.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  1062. Part44.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  1063. Part44.brickColor = BrickColor.new("Bright yellow")
  1064. Part44.FormFactor = Enum.FormFactor.Custom
  1065. Part44.formFactor = Enum.FormFactor.Custom
  1066. ManualWeld45.Name = "Part-to-Wedge Strong Joint"
  1067. ManualWeld45.Parent = Part44
  1068. ManualWeld45.C0 = CFrame.new(-0.170000002, -0.87499994, 2.15499997, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1069. ManualWeld45.C1 = CFrame.new(-1.93112564, 0.269699097, 0.154999733, 1, -1.12023845e-05, 4.15740897e-06, -1.12023536e-05, -1, -7.43729879e-06, 4.15749219e-06, 7.43725241e-06, -1)
  1070. ManualWeld45.Part0 = Part44
  1071. ManualWeld46.Name = "Part-to-Part Strong Joint"
  1072. ManualWeld46.Parent = Part44
  1073. ManualWeld46.C0 = CFrame.new(-0.170000002, -0.87499994, 2.15499997, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1074. ManualWeld46.C1 = CFrame.new(-1.912714, -1.1247673, -0.15496254, 1, 3.44684258e-06, -3.32575922e-07, -3.44683485e-06, 1, 2.33251849e-05, 3.32656327e-07, -2.33251831e-05, 1)
  1075. ManualWeld46.Part0 = Part44
  1076. ManualWeld47.Name = "Part-to-Wedge Strong Joint"
  1077. ManualWeld47.Parent = Part44
  1078. ManualWeld47.C0 = CFrame.new(0.170000002, -0.87499994, -2.15499997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  1079. ManualWeld47.C1 = CFrame.new(-0.141148567, -1.11505127, 0.760468483, -1, -1.44435216e-06, -9.97842449e-08, -1.44435285e-06, 1, 6.56038083e-06, 9.97747733e-08, 6.56038083e-06, -1)
  1080. ManualWeld47.Part0 = Part44
  1081. ManualWeld48.Name = "Part-to-Part Strong Joint"
  1082. ManualWeld48.Parent = Part44
  1083. ManualWeld48.C0 = CFrame.new(0.170000002, -0.87499994, -2.15499997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  1084. ManualWeld48.C1 = CFrame.new(-1.62726784, -0.260026932, 0.772093773, -1, 1.37986717e-06, 1.33062073e-07, 1.37986592e-06, 1, -9.32501371e-06, -1.33074948e-07, -9.32501371e-06, -1)
  1085. ManualWeld48.Part0 = Part44
  1086. ManualWeld49.Name = "Part-to-Part Strong Joint"
  1087. ManualWeld49.Parent = Part44
  1088. ManualWeld49.C0 = CFrame.new(-0.134000003, -1.19259989, -0.134000003, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  1089. ManualWeld49.C1 = CFrame.new(2.57160187, -1.14545727, -0.160079002, 4.00813451e-06, -4.30215277e-06, -1, -0.000143556827, 1, -4.30272803e-06, 1, 0.000143556841, 4.00751651e-06)
  1090. ManualWeld49.Part0 = Part44
  1091. ManualWeld50.Name = "Part-to-Part Strong Joint"
  1092. ManualWeld50.Parent = Part44
  1093. ManualWeld50.C0 = CFrame.new(-0.134000003, -1.19259989, -0.134000003, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  1094. ManualWeld50.C1 = CFrame.new(2.57813263, -2.24738407, -0.134685516, 2.3701547e-07, -2.55085524e-07, -1, 2.18151545e-05, 1, -2.55080323e-07, 1, -2.18151545e-05, 2.37021027e-07)
  1095. ManualWeld50.Part0 = Part44
  1096. Configuration51.Parent = Part44
  1097. NumberValue52.Name = "BoostSpeed"
  1098. NumberValue52.Parent = Configuration51
  1099. NumberValue52.Value = 70
  1100. NumberValue53.Name = "Acceleration"
  1101. NumberValue53.Parent = Configuration51
  1102. NumberValue53.Value = 5
  1103. NumberValue54.Name = "TurnSpeed"
  1104. NumberValue54.Parent = Configuration51
  1105. NumberValue54.Value = 0.5
  1106. NumberValue55.Name = "TopSpeed"
  1107. NumberValue55.Parent = Configuration51
  1108. NumberValue55.Value = 50
  1109. Part56.Parent = Model1
  1110. Part56.CFrame = CFrame.new(-10.0310135, 5.79162979, -1.089149, 0.999999583, 0, 3.12638804e-13, 0, 1, 0, -3.12638804e-13, 0, 0.999999583)
  1111. Part56.Position = Vector3.new(-10.0310135, 5.79162979, -1.089149)
  1112. Part56.Transparency = 10
  1113. Part56.Size = Vector3.new(0.0500000007, 2.55000401, 0.269999981)
  1114. Part56.BottomSurface = Enum.SurfaceType.Smooth
  1115. Part56.Reflectance = 10
  1116. Part56.TopSurface = Enum.SurfaceType.Smooth
  1117. Trail57.Parent = Part56
  1118. Trail57.Attachment0 = nil
  1119. Trail57.Attachment1 = nil
  1120. Trail57.Color = ColorSequence.new(Color3.new(1, 0.979049, 0.04065),Color3.new(1, 0.979049, 0.04065))
  1121. Trail57.LightEmission = 0.25
  1122. Trail57.TextureLength = 5
  1123. Trail57.Transparency = NumberSequence.new(0,0)
  1124. Trail57.Lifetime = 10
  1125. for i,v in pairs(mas:GetChildren()) do
  1126. v.Parent = workspace
  1127. pcall(function() v:MakeJoints() end)
  1128. end
  1129. mas:Destroy()
  1130. for i,v in pairs(cors) do
  1131. spawn(function()
  1132. pcall(v)
  1133. end)
  1134. end
Advertisement
Add Comment
Please, Sign In to add comment