Advertisement
cat568

Untitled

Dec 30th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.85 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Model0 = Instance.new("Model")
  20. Model1 = Instance.new("Model")
  21. Folder2 = Instance.new("Folder")
  22. NumberValue3 = Instance.new("NumberValue")
  23. NumberValue4 = Instance.new("NumberValue")
  24. MeshPart5 = Instance.new("MeshPart")
  25. MeshPart6 = Instance.new("MeshPart")
  26. MeshPart7 = Instance.new("MeshPart")
  27. MeshPart8 = Instance.new("MeshPart")
  28. Decal9 = Instance.new("Decal")
  29. Decal10 = Instance.new("Decal")
  30. Decal11 = Instance.new("Decal")
  31. Decal12 = Instance.new("Decal")
  32. Decal13 = Instance.new("Decal")
  33. Decal14 = Instance.new("Decal")
  34. MeshPart15 = Instance.new("MeshPart")
  35. VehicleSeat16 = Instance.new("VehicleSeat")
  36. Sound17 = Instance.new("Sound")
  37. Sound18 = Instance.new("Sound")
  38. Script19 = Instance.new("Script")
  39. LocalScript20 = Instance.new("LocalScript")
  40. ObjectValue21 = Instance.new("ObjectValue")
  41. BodyAngularVelocity22 = Instance.new("BodyAngularVelocity")
  42. BodyGyro23 = Instance.new("BodyGyro")
  43. BodyVelocity24 = Instance.new("BodyVelocity")
  44. Script25 = Instance.new("Script")
  45. LocalScript26 = Instance.new("LocalScript")
  46. ModuleScript27 = Instance.new("ModuleScript")
  47. ScreenGui28 = Instance.new("ScreenGui")
  48. ObjectValue29 = Instance.new("ObjectValue")
  49. Frame30 = Instance.new("Frame")
  50. TextLabel31 = Instance.new("TextLabel")
  51. TextLabel32 = Instance.new("TextLabel")
  52. LocalScript33 = Instance.new("LocalScript")
  53. Frame34 = Instance.new("Frame")
  54. TextLabel35 = Instance.new("TextLabel")
  55. TextButton36 = Instance.new("TextButton")
  56. LocalScript37 = Instance.new("LocalScript")
  57. TextButton38 = Instance.new("TextButton")
  58. LocalScript39 = Instance.new("LocalScript")
  59. TextButton40 = Instance.new("TextButton")
  60. LocalScript41 = Instance.new("LocalScript")
  61. TextLabel42 = Instance.new("TextLabel")
  62. TextButton43 = Instance.new("TextButton")
  63. LocalScript44 = Instance.new("LocalScript")
  64. TextButton45 = Instance.new("TextButton")
  65. LocalScript46 = Instance.new("LocalScript")
  66. Script47 = Instance.new("Script")
  67. Script48 = Instance.new("Script")
  68. Part49 = Instance.new("Part")
  69. Part50 = Instance.new("Part")
  70. ManualWeld51 = Instance.new("ManualWeld")
  71. ManualWeld52 = Instance.new("ManualWeld")
  72. ManualWeld53 = Instance.new("ManualWeld")
  73. ManualWeld54 = Instance.new("ManualWeld")
  74. ManualWeld55 = Instance.new("ManualWeld")
  75. ManualWeld56 = Instance.new("ManualWeld")
  76. Configuration57 = Instance.new("Configuration")
  77. NumberValue58 = Instance.new("NumberValue")
  78. NumberValue59 = Instance.new("NumberValue")
  79. NumberValue60 = Instance.new("NumberValue")
  80. NumberValue61 = Instance.new("NumberValue")
  81. Part62 = Instance.new("Part")
  82. Trail63 = Instance.new("Trail")
  83. Model0.Name = "Tron"
  84. Model0.Parent = mas
  85. Model1.Parent = Model0
  86. Folder2.Name = "Variables"
  87. Folder2.Parent = Model1
  88. NumberValue3.Name = "Speed"
  89. NumberValue3.Parent = Folder2
  90. NumberValue4.Name = "turnSpeed"
  91. NumberValue4.Parent = Folder2
  92. MeshPart5.Parent = Model1
  93. MeshPart5.CFrame = CFrame.new(-44.3620644, 1.01031804, 10.0226479, 3.12638804e-13, 0.104528531, -0.99452126, 0, 0.994521677, 0.104528576, 0.999999583, -3.28626015e-14, 3.12638804e-13)
  94. MeshPart5.Orientation = Vector3.new(-6, -90, 0)
  95. MeshPart5.Position = Vector3.new(-44.3620644, 1.01031804, 10.0226479)
  96. MeshPart5.Rotation = Vector3.new(-90, -84, -90)
  97. MeshPart5.Color = Color3.new(0.388235, 0.372549, 0.384314)
  98. MeshPart5.Size = Vector3.new(2.90573525, 1.0300386, 3.35822749)
  99. MeshPart5.Anchored = true
  100. MeshPart5.BrickColor = BrickColor.new("Dark stone grey")
  101. MeshPart5.Material = Enum.Material.SmoothPlastic
  102. MeshPart5.brickColor = BrickColor.new("Dark stone grey")
  103. MeshPart6.Parent = Model1
  104. MeshPart6.CFrame = CFrame.new(-40.8311272, 3.35569501, 10.0235023, 2.34479103e-13, 0.765564382, -0.643345416, 6.7302355e-20, 0.643351197, 0.765571296, 0.999991, -1.77635684e-13, 1.52766688e-13)
  105. MeshPart6.Orientation = Vector3.new(-49.9599991, -90, 0)
  106. MeshPart6.Position = Vector3.new(-40.8311272, 3.35569501, 10.0235023)
  107. MeshPart6.Rotation = Vector3.new(-90, -40.0400009, -90)
  108. MeshPart6.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  109. MeshPart6.Size = Vector3.new(1.13391185, 1.53102779, 2.73461723)
  110. MeshPart6.Anchored = true
  111. MeshPart6.BrickColor = BrickColor.new("Really black")
  112. MeshPart6.Material = Enum.Material.SmoothPlastic
  113. MeshPart6.brickColor = BrickColor.new("Really black")
  114. MeshPart7.Parent = Model1
  115. MeshPart7.CFrame = CFrame.new(-47.0620842, 2.14410996, 10.0231276, -3.12638804e-13, 0, -0.999999583, 0, -1, -0, -0.999999583, 0, 3.12638804e-13)
  116. MeshPart7.Orientation = Vector3.new(0, -90, 180)
  117. MeshPart7.Position = Vector3.new(-47.0620842, 2.14410996, 10.0231276)
  118. MeshPart7.Rotation = Vector3.new(0, -89.9499969, -180)
  119. MeshPart7.Color = Color3.new(0.337255, 0.141176, 0.141176)
  120. MeshPart7.Size = Vector3.new(1.57169211, 0.735109806, 1.05706239)
  121. MeshPart7.Anchored = true
  122. MeshPart7.BrickColor = BrickColor.new("Cocoa")
  123. MeshPart7.Material = Enum.Material.Neon
  124. MeshPart7.brickColor = BrickColor.new("Cocoa")
  125. MeshPart8.Parent = Model1
  126. MeshPart8.CFrame = CFrame.new(-42.567688, 1.58956206, 10.0148964, -3.12638804e-13, 3.2187252e-20, -0.999999583, -1.02323895e-07, -0.999999523, 0, -0.999999106, 1.02323853e-07, 3.12638804e-13)
  127. MeshPart8.Orientation = Vector3.new(0, -90, -180)
  128. MeshPart8.Position = Vector3.new(-42.567688, 1.58956206, 10.0148964)
  129. MeshPart8.Rotation = Vector3.new(0, -89.9499969, -180)
  130. MeshPart8.Color = Color3.new(1, 0.666667, 0)
  131. MeshPart8.Size = Vector3.new(1.81559074, 3.1242187, 10.873642)
  132. MeshPart8.Anchored = true
  133. MeshPart8.BrickColor = BrickColor.new("Deep orange")
  134. MeshPart8.Material = Enum.Material.Neon
  135. MeshPart8.brickColor = BrickColor.new("Deep orange")
  136. Decal9.Parent = MeshPart8
  137. Decal9.Texture = "http://www.roblox.com/asset/?id=731485620"
  138. Decal9.Transparency = 0.20000000298023
  139. Decal9.Face = Enum.NormalId.Right
  140. Decal10.Parent = MeshPart8
  141. Decal10.Texture = "http://www.roblox.com/asset/?id=731485620"
  142. Decal10.Transparency = 0.20000000298023
  143. Decal10.Face = Enum.NormalId.Back
  144. Decal11.Parent = MeshPart8
  145. Decal11.Texture = "http://www.roblox.com/asset/?id=731485620"
  146. Decal11.Transparency = 0.20000000298023
  147. Decal11.Face = Enum.NormalId.Top
  148. Decal12.Parent = MeshPart8
  149. Decal12.Texture = "http://www.roblox.com/asset/?id=731485620"
  150. Decal12.Transparency = 0.20000000298023
  151. Decal12.Face = Enum.NormalId.Left
  152. Decal13.Parent = MeshPart8
  153. Decal13.Texture = "http://www.roblox.com/asset/?id=731485620"
  154. Decal13.Transparency = 0.20000000298023
  155. Decal14.Parent = MeshPart8
  156. Decal14.Texture = "http://www.roblox.com/asset/?id=731485620"
  157. Decal14.Transparency = 0.20000000298023
  158. Decal14.Face = Enum.NormalId.Bottom
  159. MeshPart15.Parent = Model1
  160. MeshPart15.CFrame = CFrame.new(-42.5582161, 1.73978806, 10.0228996, 9.1390838e-08, 0, 0.999999166, 0, 1, 0, -0.999999166, 0, 9.1390838e-08)
  161. MeshPart15.Orientation = Vector3.new(0, 90, 0)
  162. MeshPart15.Position = Vector3.new(-42.5582161, 1.73978806, 10.0228996)
  163. MeshPart15.Rotation = Vector3.new(0, 89.9300003, 0)
  164. MeshPart15.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  165. MeshPart15.Size = Vector3.new(1.85247803, 3.45957899, 10.8464804)
  166. MeshPart15.Anchored = true
  167. MeshPart15.BrickColor = BrickColor.new("Really black")
  168. MeshPart15.Material = Enum.Material.SmoothPlastic
  169. MeshPart15.brickColor = BrickColor.new("Really black")
  170. VehicleSeat16.Parent = Model1
  171. VehicleSeat16.CFrame = CFrame.new(-43.5316658, 2.33507204, 10.0902443, -0.00378999859, 0.706787765, -0.707415581, 0.00378999859, 0.707425773, 0.706777513, 0.999985635, -2.41791054e-06, -0.00535986666)
  172. VehicleSeat16.Orientation = Vector3.new(-44.9700012, -90.4300003, 0.310000002)
  173. VehicleSeat16.Position = Vector3.new(-43.5316658, 2.33507204, 10.0902443)
  174. VehicleSeat16.Rotation = Vector3.new(-90.4300003, -45.0299988, -90.3099976)
  175. VehicleSeat16.Transparency = 1
  176. VehicleSeat16.MaxSpeed = 10
  177. VehicleSeat16.Size = Vector3.new(1.34000015, 0.200000003, 1)
  178. VehicleSeat16.Anchored = true
  179. VehicleSeat16.BottomSurface = Enum.SurfaceType.Smooth
  180. VehicleSeat16.TopSurface = Enum.SurfaceType.Smooth
  181. VehicleSeat16.HeadsUpDisplay = false
  182. Sound17.Name = "Boost"
  183. Sound17.Parent = VehicleSeat16
  184. Sound17.SoundId = "rbxassetid://278445103"
  185. Sound17.Volume = 1
  186. Sound18.Name = "Idle"
  187. Sound18.Parent = VehicleSeat16
  188. Sound18.Looped = true
  189. Sound18.SoundId = "rbxassetid://229396691"
  190. Sound18.Volume = 1
  191. Script19.Name = "LeanAnimator"
  192. Script19.Parent = VehicleSeat16
  193. table.insert(cors,sandbox(Script19,function()
  194. script.Parent.ChildAdded:connect(function(child)
  195. if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
  196. local P=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
  197. local S=script.L:Clone() S.Parent=P.PlayerGui
  198. S.Seat.Value=script.Parent
  199. S.Disabled=false
  200. end
  201. end)
  202. end))
  203. LocalScript20.Name = "L"
  204. LocalScript20.Parent = Script19
  205. table.insert(cors,sandbox(LocalScript20,function()
  206. script:WaitForChild("Seat")
  207. local C=game.Players.LocalPlayer.Character
  208. local S=script.Seat.Value
  209. local A=C.Animate
  210. local WS={}
  211. local HW={}
  212.  
  213. local LeanIn={
  214. 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
  215. 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
  216. 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
  217. 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
  218. 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
  219. 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
  220. }
  221.  
  222. local LeanRight={
  223. 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
  224. 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
  225. 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
  226. 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
  227. 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
  228. 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
  229. }
  230. local LeanLeft={
  231. 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
  232. 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
  233. 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
  234. 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
  235. 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
  236. 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
  237. }
  238.  
  239. local Idle={
  240. 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
  241. 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
  242. 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
  243. 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
  244. 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
  245. 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
  246. }
  247.  
  248. 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)
  249. function MW(x,y)
  250. local WW=Instance.new("Weld",x) WW.Part0=x WW.Part1=y return WW
  251. end
  252.  
  253.  
  254. if C:FindFirstChild("HumanoidRootPart")~=nil and C:FindFirstChild("Torso")~=nil then
  255. A.Disabled=true
  256. A.Parent=script
  257. S.SeatWeld.C0=CFrame.new()
  258. S.SeatWeld.C1=CFrame.new()
  259. C.HumanoidRootPart.RootJoint.Part1=nil
  260. table.insert(WS,{C.HumanoidRootPart.RootJoint,C.HumanoidRootPart.RootJoint.C0,C.HumanoidRootPart.RootJoint.C1,MW(C.HumanoidRootPart,C.Torso),C.Torso})
  261. if C.Torso:FindFirstChild("Neck")~=nil then
  262. local H=C.Head:Clone()
  263. H.Parent=S.Parent
  264. local WH=MW(C.Torso,H)
  265. WH.C0=C.Torso.Neck.C0
  266. WH.C1=C.Torso.Neck.C0
  267. C.Head.Transparency=1
  268. table.insert(HW,{H,WH,C.Head})
  269. table.insert(WS,{WH,nil,nil,nil,nil})
  270. for i,v in pairs(C.Head:GetChildren()) do
  271. if v:IsA("Weld") then
  272. local pp=v.Part1:Clone()
  273. pp.Parent=S.Parent
  274. v.Part1.Transparency=1
  275. local ww=MW(H,pp)
  276. ww.C0=v.C0
  277. ww.C1=v.C1
  278. table.insert(HW,{pp,ww,v.Part1})
  279. end
  280. end
  281. else
  282. table.insert(WS,0)
  283. end
  284. if C.Torso:FindFirstChild("Left Shoulder")~=nil then
  285. C.Torso:FindFirstChild("Left Shoulder").Part1=nil
  286. 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")})
  287. else
  288. table.insert(WS,0)
  289. end
  290. if C.Torso:FindFirstChild("Right Shoulder")~=nil then
  291. C.Torso:FindFirstChild("Right Shoulder").Part1=nil
  292. 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")})
  293. else
  294. table.insert(WS,0)
  295. end
  296. if C.Torso:FindFirstChild("Left Hip")~=nil then
  297. C.Torso:FindFirstChild("Left Hip").Part1=nil
  298. 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")})
  299. else
  300. table.insert(WS,0)
  301. end
  302. if C.Torso:FindFirstChild("Right Hip")~=nil then
  303. C.Torso:FindFirstChild("Right Hip").Part1=nil
  304. 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")})
  305. else
  306. table.insert(WS,0)
  307. end
  308. end
  309.  
  310. for i,v in pairs(WS) do
  311. if v[4]~=nil then
  312. v[4].C0=LeanIn[i]
  313. v[4].C1=CFrame.new()
  314. else
  315. v[1].C0=LeanIn[i]
  316. v[1].C1=CFrame.new()
  317. end
  318. end
  319.  
  320. function getC(w,c)
  321. local ax,ay,az,ar00,ar01,ar02,ar10,ar11,ar12,ar20,ar21,ar22=CFrame.new().components(w.C0)
  322. local bx,by,bz,br00,br01,br02,br10,ar11,br12,br20,br21,br22=CFrame.new().components(c)
  323. local ca={ax,ay,az,ar00,ar01,ar02,ar10,ar11,ar12,ar20,ar21,ar22}
  324. local cb={bx,by,bz,br00,br01,br02,br10,ar11,br12,br20,br21,br22}
  325. local cd={}
  326. for i,v in pairs(ca) do
  327. table.insert(cd,(cb[i]-v)/10)
  328. end
  329. return cd
  330. end
  331. function tween(w,cd)
  332. local cx,cy,cz,cr00,cr01,cr02,cr10,cr11,cr12,cr20,cr21,cr22=CFrame.new().components(w.C0)
  333. local cc={cx,cy,cz,cr00,cr01,cr02,cr10,cr11,cr12,cr20,cr21,cr22}
  334. local ce={}
  335. for i,v in pairs(cc) do
  336. table.insert(ce,v+cd[i])
  337. end
  338. 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])
  339. end
  340. function setPose(p)
  341. for i,v in pairs(WS) do
  342. if v[4]~=nil then
  343. tween(v[4],p[i])
  344. else
  345. tween(v[1],p[i])
  346. end
  347. end
  348. end
  349. function getPose(p)
  350. local ps={}
  351. for i,v in pairs(WS) do
  352. if v[4]~=nil then
  353. table.insert(ps,getC(v[4],p[i]))
  354. else
  355. table.insert(ps,getC(v[1],p[i]))
  356. end
  357. end
  358. return(ps)
  359. end
  360.  
  361. local steer=S.Steer
  362. local idling=false
  363. local frame=0
  364. pose=getPose(LeanIn)
  365. while wait() do
  366. if S.Velocity.Magnitude<3 and not idling then
  367. idling=true
  368. frame=0
  369. pose=getPose(Idle)
  370. else
  371. if S.Velocity.Magnitude>3 and (S.Steer~=steer or idling==true) then
  372. steer=S.Steer
  373. frame=0
  374. if steer==0 then
  375. pose=getPose(LeanIn)
  376. elseif steer==1 then
  377. pose=getPose(LeanRight)
  378. else
  379. pose=getPose(LeanLeft)
  380. end
  381. idling=false
  382. end
  383. end
  384. if frame<10 then
  385. frame=frame+1
  386. setPose(pose)
  387. end
  388. end
  389. end))
  390. LocalScript20.Disabled = true
  391. ObjectValue21.Name = "Seat"
  392. ObjectValue21.Parent = LocalScript20
  393. BodyAngularVelocity22.Name = "angv"
  394. BodyAngularVelocity22.Parent = VehicleSeat16
  395. BodyAngularVelocity22.AngularVelocity = Vector3.new(0, 0, 0)
  396. BodyAngularVelocity22.MaxTorque = Vector3.new(1e+09, 1e+09, 1e+09)
  397. BodyAngularVelocity22.angularvelocity = Vector3.new(0, 0, 0)
  398. BodyAngularVelocity22.maxTorque = Vector3.new(1e+09, 1e+09, 1e+09)
  399. BodyGyro23.Name = "gy"
  400. BodyGyro23.Parent = VehicleSeat16
  401. BodyGyro23.MaxTorque = Vector3.new(0, 0, 1e+10)
  402. BodyGyro23.maxTorque = Vector3.new(0, 0, 1e+10)
  403. BodyGyro23.D = 250
  404. BodyVelocity24.Name = "vel"
  405. BodyVelocity24.Parent = VehicleSeat16
  406. BodyVelocity24.MaxForce = Vector3.new(99999, 0, 99999)
  407. BodyVelocity24.maxForce = Vector3.new(99999, 0, 99999)
  408. BodyVelocity24.Velocity = Vector3.new(0, 0, 0)
  409. BodyVelocity24.velocity = Vector3.new(0, 0, 0)
  410. Script25.Name = "Engine"
  411. Script25.Parent = VehicleSeat16
  412. table.insert(cors,sandbox(Script25,function()
  413. local vUpdate=require(script:WaitForChild("VehicleUpdater"))
  414.  
  415. local player=nil
  416.  
  417. script.Parent.ChildAdded:connect(function(v)
  418. if v:IsA("Weld") and v.Name=="SeatWeld" then --Hey, players use this to sit!
  419. player=game.Players:GetPlayerFromCharacter(v.Part1.Parent)
  420. if player then --WE GOT ONE!!!
  421. script.VControls:Clone().Parent=player.PlayerGui
  422. end
  423. end
  424. end)
  425. script.Parent.ChildRemoved:connect(function(v)
  426. if v:IsA("Weld") and v.Name=="SeatWeld" and player then
  427. local scr=player.PlayerGui:FindFirstChild("VControls")
  428. if scr then scr:Destroy() end
  429. end
  430. end)
  431. end))
  432. LocalScript26.Name = "VControls"
  433. LocalScript26.Parent = Script25
  434. table.insert(cors,sandbox(LocalScript26,function()
  435. local pl=game.Players.LocalPlayer
  436. local cam=workspace.CurrentCamera
  437. local seat=cam.CameraSubject
  438. local vehicle=seat.Parent
  439.  
  440.  
  441. local vUpdate=require(seat.Engine:FindFirstChild("VehicleUpdater"))
  442. print('VEHICLE CONTROL INITIALIZED.')
  443. print('DRIVER NAME: '.. pl.Name)
  444. print('VEHICLE NAME: '.. vehicle.Name)
  445.  
  446. while wait() do
  447. vUpdate(pl,vehicle)
  448. end
  449. end))
  450. ModuleScript27.Name = "VehicleUpdater"
  451. ModuleScript27.Parent = Script25
  452. table.insert(cors,sandbox(ModuleScript27,function()
  453. local handling = ( 2 ) *.05;
  454. local maxTurn = ( 4 );
  455. local acceleration = ( 2 ) *.05;
  456. local topSpeed = ( 5 ) +250;
  457.  
  458. local visualTorque = ( 5 ) *.1
  459.  
  460. local boospeed=0
  461. local debounce=false
  462. local zoomin=false
  463.  
  464. local function explode(p)
  465. local e=Instance.new("Fire")
  466. e.Parent=workspace
  467. end
  468.  
  469. local function boost(boospe,vel,seat,cam)
  470. local boostSound=seat.Boost
  471. boostSound:Play()
  472.  
  473. debounce=true
  474. zoomin=true
  475. for i=1,15 do
  476. cam.FieldOfView=(60-cam.FieldOfView)*.1+cam.FieldOfView
  477. game:GetService("RunService").RenderStepped:wait()
  478. end
  479. --boostCharge:Stop()
  480. --boostSound:Play()
  481. explode(seat.CFrame.p)
  482. zoomin=false
  483. boospeed=boospe
  484. vel.velocity=vel.velocity+seat.CFrame.lookVector*boospe
  485. cam.FieldOfView=100
  486. wait(.1)
  487. debounce=false
  488. end
  489.  
  490. return function(player,vehicle)
  491. local cam=workspace.CurrentCamera
  492.  
  493. local seat=vehicle:FindFirstChild("VehicleSeat")
  494.  
  495. local angv=seat:FindFirstChild("angv")
  496. local vel=seat:FindFirstChild("vel")
  497. local gyro=seat:FindFirstChild("gy")
  498.  
  499. local variables=vehicle:FindFirstChild("Variables")
  500. local speed=variables.Speed
  501.  
  502. --Control
  503. if seat.Steer~=0 then
  504. variables.turnSpeed.Value=maxTurn*seat.Steer
  505. else
  506. variables.turnSpeed.Value=0
  507. end
  508. if seat.Throttle==1 then
  509. speed.Value=topSpeed+boospeed
  510. elseif seat.Throttle==-1 then
  511. speed.Value=-topSpeed/2-boospeed
  512. else
  513. speed.Value=0
  514. end
  515.  
  516. --Update
  517. local idle=seat.Idle
  518. if not idle.IsPlaying then idle:Play() end
  519. idle.Pitch=.3+(vel.velocity.Magnitude/topSpeed)
  520.  
  521. local lv=seat.CFrame.lookVector
  522. local roll=(-angv.angularvelocity.y/maxTurn)*((vel.velocity.Magnitude/topSpeed)*.7+.3)
  523.  
  524. vel.velocity=vel.velocity:Lerp(lv*variables.Speed.Value,acceleration)
  525. angv.angularvelocity=angv.angularvelocity:Lerp(Vector3.new(0,-variables.turnSpeed.Value,0),handling)
  526. gyro.cframe=CFrame.fromAxisAngle(lv,roll)
  527.  
  528. if boospeed<=0 then boospeed=0 else boospeed=boospeed-1 end
  529. if zoomin==false then cam.FieldOfView=(70-cam.FieldOfView)*.05+cam.FieldOfView end
  530.  
  531. cam.CameraType="Track"
  532.  
  533. --Check for boosters or hazards
  534. vehicle:FindFirstChild("GyroBall").Touched:connect(function(p)
  535. if p.Name=="Boost" and debounce==false then boost(50,vel,seat,cam) end
  536. end)
  537. end
  538. end))
  539. ScreenGui28.Name = "CAMERACONTROL"
  540. ScreenGui28.Parent = VehicleSeat16
  541. ObjectValue29.Name = "CarSeat"
  542. ObjectValue29.Parent = ScreenGui28
  543. Frame30.Name = "SPDCTR"
  544. Frame30.Parent = ScreenGui28
  545. Frame30.Position = UDim2.new(1, -275, 1, -60)
  546. Frame30.Size = UDim2.new(0, 106, 0, 50)
  547. Frame30.Active = true
  548. Frame30.BackgroundColor = BrickColor.new("Institutional white")
  549. Frame30.BackgroundColor3 = Color3.new(1, 1, 1)
  550. Frame30.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  551. Frame30.Draggable = true
  552. Frame30.Style = Enum.FrameStyle.RobloxRound
  553. TextLabel31.Name = "sps"
  554. TextLabel31.Parent = Frame30
  555. TextLabel31.Position = UDim2.new(1, -27, 0.5, 0)
  556. TextLabel31.BackgroundColor = BrickColor.new("Institutional white")
  557. TextLabel31.BackgroundColor3 = Color3.new(1, 1, 1)
  558. TextLabel31.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  559. TextLabel31.BorderSizePixel = 0
  560. TextLabel31.Font = Enum.Font.SourceSansBold
  561. TextLabel31.FontSize = Enum.FontSize.Size24
  562. TextLabel31.Text = "sps"
  563. TextLabel31.TextColor = BrickColor.new("Pearl")
  564. TextLabel31.TextColor3 = Color3.new(0.901961, 0.901961, 0.901961)
  565. TextLabel31.TextSize = 24
  566. TextLabel31.TextStrokeTransparency = 0
  567. TextLabel31.TextXAlignment = Enum.TextXAlignment.Left
  568. TextLabel32.Name = "NUMBER"
  569. TextLabel32.Parent = Frame30
  570. TextLabel32.Position = UDim2.new(0, 60, 1, -20)
  571. TextLabel32.BackgroundColor = BrickColor.new("Institutional white")
  572. TextLabel32.BackgroundColor3 = Color3.new(1, 1, 1)
  573. TextLabel32.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  574. TextLabel32.BorderSizePixel = 0
  575. TextLabel32.Font = Enum.Font.SourceSans
  576. TextLabel32.FontSize = Enum.FontSize.Size48
  577. TextLabel32.Text = "999"
  578. TextLabel32.TextColor = BrickColor.new("Pearl")
  579. TextLabel32.TextColor3 = Color3.new(0.901961, 0.901961, 0.901961)
  580. TextLabel32.TextSize = 48
  581. TextLabel32.TextStrokeTransparency = 0
  582. TextLabel32.TextXAlignment = Enum.TextXAlignment.Right
  583. LocalScript33.Parent = TextLabel32
  584. table.insert(cors,sandbox(LocalScript33,function()
  585. local seat = script.Parent.Parent.Parent.CarSeat.Value
  586.  
  587. while wait(0.1) do
  588. if seat == nil then wait(1) -- we won't break if the value returns nil
  589. else script.Parent.Text = math.floor(seat.Velocity.Magnitude)
  590. end
  591. end
  592. end))
  593. Frame34.Name = "CONTAINER"
  594. Frame34.Parent = ScreenGui28
  595. Frame34.Position = UDim2.new(1, -250, 1, -180)
  596. Frame34.Visible = false
  597. Frame34.Size = UDim2.new(0, 200, 0, 120)
  598. Frame34.Active = true
  599. Frame34.BackgroundColor = BrickColor.new("Institutional white")
  600. Frame34.BackgroundColor3 = Color3.new(1, 1, 1)
  601. Frame34.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  602. Frame34.Style = Enum.FrameStyle.RobloxRound
  603. TextLabel35.Name = "Label"
  604. TextLabel35.Parent = Frame34
  605. TextLabel35.Position = UDim2.new(0, 2, 0.5, -2)
  606. TextLabel35.Rotation = -90
  607. TextLabel35.BackgroundColor = BrickColor.new("Institutional white")
  608. TextLabel35.BackgroundColor3 = Color3.new(1, 1, 1)
  609. TextLabel35.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  610. TextLabel35.BorderSizePixel = 0
  611. TextLabel35.Font = Enum.Font.SourceSansBold
  612. TextLabel35.FontSize = Enum.FontSize.Size24
  613. TextLabel35.Text = "Camera"
  614. TextLabel35.TextColor = BrickColor.new("Institutional white")
  615. TextLabel35.TextColor3 = Color3.new(1, 1, 1)
  616. TextLabel35.TextSize = 24
  617. TextLabel35.TextStrokeTransparency = 0
  618. TextButton36.Name = "ATTACH"
  619. TextButton36.Parent = Frame34
  620. TextButton36.Position = UDim2.new(0, 25, 0, 0)
  621. TextButton36.Size = UDim2.new(0, 70, 0, 30)
  622. TextButton36.BackgroundColor = BrickColor.new("Institutional white")
  623. TextButton36.BackgroundColor3 = Color3.new(1, 1, 1)
  624. TextButton36.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  625. TextButton36.Style = Enum.ButtonStyle.RobloxButton
  626. TextButton36.Font = Enum.Font.SourceSans
  627. TextButton36.FontSize = Enum.FontSize.Size18
  628. TextButton36.Text = "Attach"
  629. TextButton36.TextColor = BrickColor.new("Institutional white")
  630. TextButton36.TextColor3 = Color3.new(1, 1, 1)
  631. TextButton36.TextSize = 18
  632. LocalScript37.Name = "CamScript"
  633. LocalScript37.Parent = TextButton36
  634. table.insert(cors,sandbox(LocalScript37,function()
  635. local cam = Workspace.CurrentCamera
  636.  
  637. function ChangeCameraFP() -- scroll in for this one
  638. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  639. cam.CameraType = "Attach"
  640. end
  641.  
  642. function onButtonClicked()
  643. ChangeCameraFP()
  644. end
  645. script.Parent.MouseButton1Down:connect(onButtonClicked)
  646. end))
  647. TextButton38.Name = "FOLLOW"
  648. TextButton38.Parent = Frame34
  649. TextButton38.Position = UDim2.new(1, -80, 0, 0)
  650. TextButton38.Size = UDim2.new(0, 70, 0, 30)
  651. TextButton38.BackgroundColor = BrickColor.new("Institutional white")
  652. TextButton38.BackgroundColor3 = Color3.new(1, 1, 1)
  653. TextButton38.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  654. TextButton38.Style = Enum.ButtonStyle.RobloxButton
  655. TextButton38.Font = Enum.Font.SourceSans
  656. TextButton38.FontSize = Enum.FontSize.Size18
  657. TextButton38.Text = "Follow"
  658. TextButton38.TextColor = BrickColor.new("Institutional white")
  659. TextButton38.TextColor3 = Color3.new(1, 1, 1)
  660. TextButton38.TextSize = 18
  661. LocalScript39.Name = "CamScript"
  662. LocalScript39.Parent = TextButton38
  663. table.insert(cors,sandbox(LocalScript39,function()
  664. local cam = Workspace.CurrentCamera
  665.  
  666. function ChangeCameraTPF()
  667. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  668. cam.CameraType = "Follow"
  669. end
  670.  
  671. function onButtonClicked()
  672. ChangeCameraTPF()
  673. end
  674. script.Parent.MouseButton1Down:connect(onButtonClicked)
  675. end))
  676. TextButton40.Name = "FOVUP"
  677. TextButton40.Parent = Frame34
  678. TextButton40.Position = UDim2.new(1, -45, 1, -34)
  679. TextButton40.Size = UDim2.new(0, 30, 0, 30)
  680. TextButton40.BackgroundColor = BrickColor.new("Institutional white")
  681. TextButton40.BackgroundColor3 = Color3.new(1, 1, 1)
  682. TextButton40.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  683. TextButton40.Style = Enum.ButtonStyle.RobloxButton
  684. TextButton40.Font = Enum.Font.SourceSans
  685. TextButton40.FontSize = Enum.FontSize.Size18
  686. TextButton40.Text = "+"
  687. TextButton40.TextColor = BrickColor.new("Institutional white")
  688. TextButton40.TextColor3 = Color3.new(1, 1, 1)
  689. TextButton40.TextSize = 18
  690. LocalScript41.Name = "CamScript"
  691. LocalScript41.Parent = TextButton40
  692. table.insert(cors,sandbox(LocalScript41,function()
  693. local cam = Workspace.CurrentCamera
  694.  
  695. function ChangeFOVUp()
  696. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  697. cam.FieldOfView = cam.FieldOfView + 10
  698. script.Parent.Parent.FOVNO.Text = tostring("FOV: "..math.floor(cam.FieldOfView))
  699. end
  700.  
  701. function onButtonClicked()
  702. ChangeFOVUp()
  703. end
  704. script.Parent.MouseButton1Down:connect(onButtonClicked)
  705. end))
  706. TextLabel42.Name = "FOVNO"
  707. TextLabel42.Parent = Frame34
  708. TextLabel42.Position = UDim2.new(0.5, 5, 1, -20)
  709. TextLabel42.BackgroundColor = BrickColor.new("Institutional white")
  710. TextLabel42.BackgroundColor3 = Color3.new(1, 1, 1)
  711. TextLabel42.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  712. TextLabel42.BorderSizePixel = 0
  713. TextLabel42.Font = Enum.Font.SourceSans
  714. TextLabel42.FontSize = Enum.FontSize.Size18
  715. TextLabel42.Text = "FOV: 70"
  716. TextLabel42.TextColor = BrickColor.new("Institutional white")
  717. TextLabel42.TextColor3 = Color3.new(1, 1, 1)
  718. TextLabel42.TextSize = 18
  719. TextLabel42.TextStrokeTransparency = 0
  720. TextButton43.Name = "FOVDN"
  721. TextButton43.Parent = Frame34
  722. TextButton43.Position = UDim2.new(0.5, -67, 1, -34)
  723. TextButton43.Size = UDim2.new(0, 30, 0, 30)
  724. TextButton43.BackgroundColor = BrickColor.new("Institutional white")
  725. TextButton43.BackgroundColor3 = Color3.new(1, 1, 1)
  726. TextButton43.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  727. TextButton43.Style = Enum.ButtonStyle.RobloxButton
  728. TextButton43.Font = Enum.Font.SourceSans
  729. TextButton43.FontSize = Enum.FontSize.Size18
  730. TextButton43.Text = "-"
  731. TextButton43.TextColor = BrickColor.new("Institutional white")
  732. TextButton43.TextColor3 = Color3.new(1, 1, 1)
  733. TextButton43.TextSize = 18
  734. LocalScript44.Name = "CamScript"
  735. LocalScript44.Parent = TextButton43
  736. table.insert(cors,sandbox(LocalScript44,function()
  737. local cam = Workspace.CurrentCamera
  738.  
  739. function ChangeFOVUp()
  740. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  741. cam.FieldOfView = cam.FieldOfView - 10
  742. script.Parent.Parent.FOVNO.Text = tostring("FOV: "..math.floor(cam.FieldOfView))
  743. end
  744.  
  745. function onButtonClicked()
  746. ChangeFOVUp()
  747. end
  748. script.Parent.MouseButton1Down:connect(onButtonClicked)
  749. end))
  750. TextButton45.Name = "TRACK"
  751. TextButton45.Parent = Frame34
  752. TextButton45.Position = UDim2.new(0, 25, 0, 35)
  753. TextButton45.Size = UDim2.new(0, 70, 0, 30)
  754. TextButton45.BackgroundColor = BrickColor.new("Institutional white")
  755. TextButton45.BackgroundColor3 = Color3.new(1, 1, 1)
  756. TextButton45.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
  757. TextButton45.Style = Enum.ButtonStyle.RobloxButton
  758. TextButton45.Font = Enum.Font.SourceSans
  759. TextButton45.FontSize = Enum.FontSize.Size18
  760. TextButton45.Text = "Track"
  761. TextButton45.TextColor = BrickColor.new("Institutional white")
  762. TextButton45.TextColor3 = Color3.new(1, 1, 1)
  763. TextButton45.TextSize = 18
  764. LocalScript46.Name = "CamScript"
  765. LocalScript46.Parent = TextButton45
  766. table.insert(cors,sandbox(LocalScript46,function()
  767. local cam = Workspace.CurrentCamera
  768.  
  769. function ChangeCameraTPF()
  770. cam.CameraSubject=game.Players.LocalPlayer.Character.Head
  771. cam.CameraType = "Track"
  772. end
  773.  
  774. function onButtonClicked()
  775. ChangeCameraTPF()
  776. end
  777. script.Parent.MouseButton1Down:connect(onButtonClicked)
  778. end))
  779. Script47.Name = "Gui Giver"
  780. Script47.Parent = VehicleSeat16
  781. table.insert(cors,sandbox(Script47,function()
  782. GUI = script.Parent.CAMERACONTROL
  783.  
  784. script.Parent.ChildAdded:connect(function(child)
  785. if child:IsA("Weld") then
  786. --child.C0 = CFrame.new(-1.4,-1.3,0.2)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
  787. if child.Part1.Name == "HumanoidRootPart" then
  788. player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
  789. if player and (not player.PlayerGui:FindFirstChild("CAMERACONTROL")) then --// The part after the "and" prevents multiple GUI's to be copied over.
  790. 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.
  791. GUI:Clone().Parent = player.PlayerGui --// Compact version
  792. end
  793. end
  794. end
  795. end)
  796.  
  797. script.Parent.ChildRemoved:connect(function(child)
  798. if child:IsA("Weld") then
  799. if child.Part1.Name == "HumanoidRootPart" then
  800. player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
  801. if player and player.PlayerGui:FindFirstChild("CAMERACONTROL") then
  802. player.PlayerGui:FindFirstChild("CAMERACONTROL"):Destroy()
  803. end
  804. end
  805. end
  806. end)
  807.  
  808.  
  809. end))
  810. Script48.Name = "qPerfectionWeld"
  811. Script48.Parent = Model1
  812. table.insert(cors,sandbox(Script48,function()
  813. -- Created by Quenty (@Quenty, follow me on twitter).
  814. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  815. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  816.  
  817. --[[ INSTRUCTIONS
  818. - Place in the model
  819. - Make sure model is anchored
  820. - That's it. It will weld the model and all children.
  821.  
  822. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  823. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  824. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  825. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  826. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  827. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  828. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  829. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  830.  
  831. 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.
  832. ]]
  833.  
  834. --[[ DOCUMENTATION
  835. - 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.
  836. - Will work in PBS servers
  837. - Will work as long as it starts out with the part anchored
  838. - Stores the relative CFrame as a CFrame value
  839. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  840. - Utilizes a recursive algorith to find all parts in the model
  841. - Will reweld on script reparent if the script is initially parented to a tool.
  842. - Welds as fast as possible
  843. ]]
  844.  
  845. -- qPerfectionWeld.lua
  846. -- Created 10/6/2014
  847. -- Author: Quenty
  848. -- Version 1.0.3
  849.  
  850. -- Updated 10/14/2014 - Updated to 1.0.1
  851. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  852.  
  853. -- Updated 10/14/2014 - Updated to 1.0.2
  854. --- Fixed bug fix.
  855.  
  856. -- Updated 10/14/2014 - Updated to 1.0.3
  857. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  858.  
  859. 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).
  860.  
  861.  
  862. local function CallOnChildren(Instance, FunctionToCall)
  863. -- Calls a function on each of the children of a certain object, using recursion.
  864.  
  865. FunctionToCall(Instance)
  866.  
  867. for _, Child in next, Instance:GetChildren() do
  868. CallOnChildren(Child, FunctionToCall)
  869. end
  870. end
  871.  
  872. local function GetNearestParent(Instance, ClassName)
  873. -- Returns the nearest parent of a certain class, or returns nil
  874.  
  875. local Ancestor = Instance
  876. repeat
  877. Ancestor = Ancestor.Parent
  878. if Ancestor == nil then
  879. return nil
  880. end
  881. until Ancestor:IsA(ClassName)
  882.  
  883. return Ancestor
  884. end
  885.  
  886. local function GetBricks(StartInstance)
  887. local List = {}
  888.  
  889. -- if StartInstance:IsA("BasePart") then
  890. -- List[#List+1] = StartInstance
  891. -- end
  892.  
  893. CallOnChildren(StartInstance, function(Item)
  894. if Item:IsA("BasePart") then
  895. List[#List+1] = Item;
  896. end
  897. end)
  898.  
  899. return List
  900. end
  901.  
  902. local function Modify(Instance, Values)
  903. -- Modifies an Instance by using a table.
  904.  
  905. assert(type(Values) == "table", "Values is not a table");
  906.  
  907. for Index, Value in next, Values do
  908. if type(Index) == "number" then
  909. Value.Parent = Instance
  910. else
  911. Instance[Index] = Value
  912. end
  913. end
  914. return Instance
  915. end
  916.  
  917. local function Make(ClassType, Properties)
  918. -- Using a syntax hack to create a nice way to Make new items.
  919.  
  920. return Modify(Instance.new(ClassType), Properties)
  921. end
  922.  
  923. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  924. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  925.  
  926. local function HasWheelJoint(Part)
  927. for _, SurfaceName in pairs(Surfaces) do
  928. for _, HingSurfaceName in pairs(HingSurfaces) do
  929. if Part[SurfaceName].Name == HingSurfaceName then
  930. return true
  931. end
  932. end
  933. end
  934.  
  935. return false
  936. end
  937.  
  938. local function ShouldBreakJoints(Part)
  939. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  940. -- definitely some edge cases.
  941.  
  942. if NEVER_BREAK_JOINTS then
  943. return false
  944. end
  945.  
  946. if HasWheelJoint(Part) then
  947. return false
  948. end
  949.  
  950. local Connected = Part:GetConnectedParts()
  951.  
  952. if #Connected == 1 then
  953. return false
  954. end
  955.  
  956. for _, Item in pairs(Connected) do
  957. if HasWheelJoint(Item) then
  958. return false
  959. elseif not Item:IsDescendantOf(script.Parent) then
  960. return false
  961. end
  962. end
  963.  
  964. return true
  965. end
  966.  
  967. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  968. --- Weld's 2 parts together
  969. -- @param Part0 The first part
  970. -- @param Part1 The second part (Dependent part most of the time).
  971. -- @param [JointType] The type of joint. Defaults to weld.
  972. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  973. -- @return The weld created.
  974.  
  975. JointType = JointType or "Weld"
  976. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  977.  
  978. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  979. Modify(NewWeld, {
  980. Name = "qCFrameWeldThingy";
  981. Part0 = Part0;
  982. Part1 = Part1;
  983. C0 = CFrame.new();--Part0.CFrame:inverse();
  984. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  985. Parent = Part1;
  986. })
  987.  
  988. if not RelativeValue then
  989. RelativeValue = Make("CFrameValue", {
  990. Parent = Part1;
  991. Name = "qRelativeCFrameWeldValue";
  992. Archivable = true;
  993. Value = NewWeld.C1;
  994. })
  995. end
  996.  
  997. return NewWeld
  998. end
  999.  
  1000. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  1001. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  1002. -- @param MainPart The part to weld the model to (can be in the model).
  1003. -- @param [JointType] The type of joint. Defaults to weld.
  1004. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  1005.  
  1006. for _, Part in pairs(Parts) do
  1007. if ShouldBreakJoints(Part) then
  1008. Part:BreakJoints()
  1009. end
  1010. end
  1011.  
  1012. for _, Part in pairs(Parts) do
  1013. if Part ~= MainPart then
  1014. WeldTogether(MainPart, Part, JointType, MainPart)
  1015. end
  1016. end
  1017.  
  1018. if not DoNotUnanchor then
  1019. for _, Part in pairs(Parts) do
  1020. Part.Anchored = false
  1021. end
  1022. MainPart.Anchored = false
  1023. end
  1024. end
  1025.  
  1026. local function PerfectionWeld()
  1027. local Tool = GetNearestParent(script, "Tool")
  1028.  
  1029. local Parts = GetBricks(script.Parent)
  1030. 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]
  1031.  
  1032. if PrimaryPart then
  1033. WeldParts(Parts, PrimaryPart, "Weld", false)
  1034. else
  1035. warn("qWeld - Unable to weld part")
  1036. end
  1037.  
  1038. return Tool
  1039. end
  1040.  
  1041. local Tool = PerfectionWeld()
  1042.  
  1043.  
  1044. if Tool and script.ClassName == "Script" then
  1045. --- Don't bother with local scripts
  1046.  
  1047. script.Parent.AncestryChanged:connect(function()
  1048. PerfectionWeld()
  1049. end)
  1050. end
  1051.  
  1052. -- Created by Quenty (@Quenty, follow me on twitter).
  1053.  
  1054. end))
  1055. Part49.Name = "GyroBall"
  1056. Part49.Parent = Model1
  1057. Part49.CFrame = CFrame.new(-44.2263832, 0.889780998, 10.0414457, -0.000316999998, -0.000441999873, -0.999999881, 0, 0.999999881, -0.000441999931, 1, -1.40113983e-07, -0.000316999969)
  1058. Part49.Orientation = Vector3.new(0.0299999993, -90.0199966, 0)
  1059. Part49.Position = Vector3.new(-44.2263832, 0.889780998, 10.0414457)
  1060. Part49.Rotation = Vector3.new(125.650002, -89.9700012, 125.650002)
  1061. Part49.Transparency = 1
  1062. Part49.Size = Vector3.new(1.65000021, 1.65000021, 1.65000021)
  1063. Part49.Anchored = true
  1064. Part49.BottomSurface = Enum.SurfaceType.Smooth
  1065. Part49.CanCollide = false
  1066. Part49.CustomPhysicalProperties = 0.699999988, 0, 0, 1, 1
  1067. Part49.Elasticity = 0
  1068. Part49.Friction = 0
  1069. Part49.FrontSurface = Enum.SurfaceType.Hinge
  1070. Part49.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  1071. Part49.FormFactor = Enum.FormFactor.Symmetric
  1072. Part49.formFactor = Enum.FormFactor.Symmetric
  1073. Part49.Shape = Enum.PartType.Ball
  1074. Part50.Name = "Kart"
  1075. Part50.Parent = Model1
  1076. Part50.CFrame = CFrame.new(-44.0215759, 2.39958596, 10.1892662, -3.12638804e-13, -0.999999583, -0.000404999824, 0, -0.000404999999, 1, -0.999999583, 3.12638804e-13, 1.28369537e-16)
  1077. Part50.Orientation = Vector3.new(-90, 90, 0)
  1078. Part50.Position = Vector3.new(-44.0215759, 2.39958596, 10.1892662)
  1079. Part50.Rotation = Vector3.new(-90, -0.0199999996, 90)
  1080. Part50.Color = Color3.new(0.960784, 0.803922, 0.188235)
  1081. Part50.Transparency = 1
  1082. Part50.Size = Vector3.new(0.84799999, 3.39519978, 1.2579999)
  1083. Part50.Anchored = true
  1084. Part50.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  1085. Part50.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  1086. Part50.BrickColor = BrickColor.new("Bright yellow")
  1087. Part50.CanCollide = false
  1088. Part50.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  1089. Part50.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  1090. Part50.Material = Enum.Material.SmoothPlastic
  1091. Part50.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  1092. Part50.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  1093. Part50.brickColor = BrickColor.new("Bright yellow")
  1094. Part50.FormFactor = Enum.FormFactor.Custom
  1095. Part50.formFactor = Enum.FormFactor.Custom
  1096. ManualWeld51.Name = "Part-to-Wedge Strong Joint"
  1097. ManualWeld51.Parent = Part50
  1098. ManualWeld51.C0 = CFrame.new(-0.170000002, -0.87499994, 2.15499997, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1099. ManualWeld51.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)
  1100. ManualWeld51.Part0 = Part50
  1101. ManualWeld52.Name = "Part-to-Part Strong Joint"
  1102. ManualWeld52.Parent = Part50
  1103. ManualWeld52.C0 = CFrame.new(-0.170000002, -0.87499994, 2.15499997, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  1104. ManualWeld52.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)
  1105. ManualWeld52.Part0 = Part50
  1106. ManualWeld53.Name = "Part-to-Wedge Strong Joint"
  1107. ManualWeld53.Parent = Part50
  1108. ManualWeld53.C0 = CFrame.new(0.170000002, -0.87499994, -2.15499997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  1109. ManualWeld53.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)
  1110. ManualWeld53.Part0 = Part50
  1111. ManualWeld54.Name = "Part-to-Part Strong Joint"
  1112. ManualWeld54.Parent = Part50
  1113. ManualWeld54.C0 = CFrame.new(0.170000002, -0.87499994, -2.15499997, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  1114. ManualWeld54.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)
  1115. ManualWeld54.Part0 = Part50
  1116. ManualWeld55.Name = "Part-to-Part Strong Joint"
  1117. ManualWeld55.Parent = Part50
  1118. ManualWeld55.C0 = CFrame.new(-0.134000003, -1.19259989, -0.134000003, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  1119. ManualWeld55.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)
  1120. ManualWeld55.Part0 = Part50
  1121. ManualWeld56.Name = "Part-to-Part Strong Joint"
  1122. ManualWeld56.Parent = Part50
  1123. ManualWeld56.C0 = CFrame.new(-0.134000003, -1.19259989, -0.134000003, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  1124. ManualWeld56.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)
  1125. ManualWeld56.Part0 = Part50
  1126. Configuration57.Parent = Part50
  1127. NumberValue58.Name = "BoostSpeed"
  1128. NumberValue58.Parent = Configuration57
  1129. NumberValue58.Value = 70
  1130. NumberValue59.Name = "Acceleration"
  1131. NumberValue59.Parent = Configuration57
  1132. NumberValue59.Value = 5
  1133. NumberValue60.Name = "TurnSpeed"
  1134. NumberValue60.Parent = Configuration57
  1135. NumberValue60.Value = 0.5
  1136. NumberValue61.Name = "TopSpeed"
  1137. NumberValue61.Parent = Configuration57
  1138. NumberValue61.Value = 50
  1139. Part62.Parent = Model1
  1140. Part62.CFrame = CFrame.new(-47.2370377, 1.33091295, 10.0090284, 0.999999583, 0, 3.12638804e-13, 0, 1, 0, -3.12638804e-13, 0, 0.999999583)
  1141. Part62.Position = Vector3.new(-47.2370377, 1.33091295, 10.0090284)
  1142. Part62.Transparency = 10
  1143. Part62.Size = Vector3.new(0.0500000007, 2.55000401, 0.269999981)
  1144. Part62.BottomSurface = Enum.SurfaceType.Smooth
  1145. Part62.Reflectance = 10
  1146. Part62.TopSurface = Enum.SurfaceType.Smooth
  1147. Trail63.Parent = Part62
  1148. Trail63.Attachment0 = nil
  1149. Trail63.Attachment1 = nil
  1150. Trail63.Color = ColorSequence.new(Color3.new(1, 0, 1),Color3.new(1, 0, 0.48),Color3.new(1, 0, 0),Color3.new(1, 0, 1),Color3.new(0.333333, 0, 1),Color3.new(0, 1, 1),Color3.new(0, 1, 0),Color3.new(1, 1, 0),Color3.new(1, 0.333333, 0),Color3.new(1, 0, 1),Color3.new(1, 0, 0),Color3.new(1, 0, 0.452174),Color3.new(1, 0, 0.947826),Color3.new(1, 0, 0))
  1151. Trail63.LightEmission = 0.25
  1152. Trail63.TextureLength = 5
  1153. Trail63.Transparency = NumberSequence.new(0.30000001192093,0.30000001192093)
  1154. for i,v in pairs(mas:GetChildren()) do
  1155. v.Parent = workspace
  1156. pcall(function() v:MakeJoints() end)
  1157. end
  1158. mas:Destroy()
  1159. for i,v in pairs(cors) do
  1160. spawn(function()
  1161. pcall(v)
  1162. end)
  1163. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement