Advertisement
lafur

Untitled

May 23rd, 2020
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 107.82 KB | None | 0 0
  1. -- Converted using Mokiros's Model to Script plugin
  2. -- Converted string size: 11412
  3. local genv={}
  4. local Scripts = {
  5. function() function waitForChild(parent, childName)
  6. local child = parent:findFirstChild(childName)
  7. if child then return child end
  8. while true do
  9. child = parent.ChildAdded:wait()
  10. if child.Name==childName then return child end
  11. end
  12. end
  13. local Figure = script.Parent
  14. local Torso = waitForChild(Figure, "Torso")
  15. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  16. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  17. local RightHip = waitForChild(Torso, "Right Hip")
  18. local LeftHip = waitForChild(Torso, "Left Hip")
  19. local Neck = waitForChild(Torso, "Neck")
  20. local Humanoid;
  21. for _,Child in pairs(Figure:GetChildren())do
  22. if Child and Child.ClassName=="Humanoid"then
  23. Humanoid=Child;
  24. end;
  25. end;
  26. local pose = "Standing"
  27. local currentAnim = ""
  28. local currentAnimInstance = nil
  29. local currentAnimTrack = nil
  30. local currentAnimKeyframeHandler = nil
  31. local currentAnimSpeed = 1.0
  32. local animTable = {}
  33. local animNames = {
  34. idle = {
  35. { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
  36. { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
  37. },
  38. walk = {
  39. { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
  40. },
  41. run = {
  42. { id = "run.xml", weight = 10 }
  43. },
  44. jump = {
  45. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  46. },
  47. fall = {
  48. { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
  49. },
  50. climb = {
  51. { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
  52. },
  53. sit = {
  54. { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
  55. },
  56. toolnone = {
  57. { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
  58. },
  59. toolslash = {
  60. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  61. --{ id = "slash.xml", weight = 10 }
  62. },
  63. toollunge = {
  64. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  65. },
  66. wave = {
  67. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  68. },
  69. point = {
  70. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  71. },
  72. dance1 = {
  73. { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
  74. { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
  75. { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
  76. },
  77. dance2 = {
  78. { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
  79. { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
  80. { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
  81. },
  82. dance3 = {
  83. { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
  84. { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
  85. { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
  86. },
  87. laugh = {
  88. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  89. },
  90. cheer = {
  91. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  92. },
  93. }
  94. local dances = {"dance1", "dance2", "dance3"}
  95.  
  96. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  97. local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  98.  
  99. function configureAnimationSet(name, fileList)
  100. if (animTable[name] ~= nil) then
  101. for _, connection in pairs(animTable[name].connections) do
  102. connection:disconnect()
  103. end
  104. end
  105. animTable[name] = {}
  106. animTable[name].count = 0
  107. animTable[name].totalWeight = 0
  108. animTable[name].connections = {}
  109.  
  110. -- check for config values
  111. local config = script:FindFirstChild(name)
  112. if (config ~= nil) then
  113. --print("Loading anims " .. name)
  114. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  115. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  116. local idx = 1
  117. for _, childPart in pairs(config:GetChildren()) do
  118. if (childPart:IsA("Animation")) then
  119. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  120. animTable[name][idx] = {}
  121. animTable[name][idx].anim = childPart
  122. local weightObject = childPart:FindFirstChild("Weight")
  123. if (weightObject == nil) then
  124. animTable[name][idx].weight = 1
  125. else
  126. animTable[name][idx].weight = weightObject.Value
  127. end
  128. animTable[name].count = animTable[name].count + 1
  129. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  130. --print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  131. idx = idx + 1
  132. end
  133. end
  134. end
  135.  
  136. -- fallback to defaults
  137. if (animTable[name].count <= 0) then
  138. for idx, anim in pairs(fileList) do
  139. animTable[name][idx] = {}
  140. animTable[name][idx].anim = Instance.new("Animation")
  141. animTable[name][idx].anim.Name = name
  142. animTable[name][idx].anim.AnimationId = anim.id
  143. animTable[name][idx].weight = anim.weight
  144. animTable[name].count = animTable[name].count + 1
  145. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  146. --print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  147. end
  148. end
  149. end
  150.  
  151. -- Setup animation objects
  152. function scriptChildModified(child)
  153. local fileList = animNames[child.Name]
  154. if (fileList ~= nil) then
  155. configureAnimationSet(child.Name, fileList)
  156. end
  157. end
  158.  
  159. script.ChildAdded:connect(scriptChildModified)
  160. script.ChildRemoved:connect(scriptChildModified)
  161.  
  162.  
  163. for name, fileList in pairs(animNames) do
  164. configureAnimationSet(name, fileList)
  165. end
  166.  
  167. -- ANIMATION
  168.  
  169. -- declarations
  170. local toolAnim = "None"
  171. local toolAnimTime = 0
  172.  
  173. local jumpAnimTime = 0
  174. local jumpAnimDuration = 0.3
  175.  
  176. local toolTransitionTime = 0.1
  177. local fallTransitionTime = 0.3
  178. local jumpMaxLimbVelocity = 0.75
  179.  
  180. -- functions
  181.  
  182. function stopAllAnimations()
  183. local oldAnim = currentAnim
  184.  
  185. -- return to idle if finishing an emote
  186. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  187. oldAnim = "idle"
  188. end
  189.  
  190. currentAnim = ""
  191. currentAnimInstance = nil
  192. if (currentAnimKeyframeHandler ~= nil) then
  193. currentAnimKeyframeHandler:disconnect()
  194. end
  195.  
  196. if (currentAnimTrack ~= nil) then
  197. currentAnimTrack:Stop()
  198. currentAnimTrack:Destroy()
  199. currentAnimTrack = nil
  200. end
  201. return oldAnim
  202. end
  203.  
  204. function setAnimationSpeed(speed)
  205. if speed ~= currentAnimSpeed then
  206. currentAnimSpeed = speed
  207. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  208. end
  209. end
  210.  
  211. function keyFrameReachedFunc(frameName)
  212. if (frameName == "End") then
  213.  
  214. local repeatAnim = currentAnim
  215. -- return to idle if finishing an emote
  216. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  217. repeatAnim = "idle"
  218. end
  219.  
  220. local animSpeed = currentAnimSpeed
  221. playAnimation(repeatAnim, 0.0, Humanoid)
  222. setAnimationSpeed(animSpeed)
  223. end
  224. end
  225.  
  226. -- Preload animations
  227. function playAnimation(animName, transitionTime, humanoid)
  228.  
  229. local roll = math.random(1, animTable[animName].totalWeight)
  230. local origRoll = roll
  231. local idx = 1
  232. while (roll > animTable[animName][idx].weight) do
  233. roll = roll - animTable[animName][idx].weight
  234. idx = idx + 1
  235. end
  236. --print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  237. local anim = animTable[animName][idx].anim
  238. -- switch animation
  239. if (anim ~= currentAnimInstance) then
  240. if (currentAnimTrack ~= nil) then
  241. currentAnimTrack:Stop(transitionTime)
  242. currentAnimTrack:Destroy()
  243. end
  244. currentAnimSpeed = 1.0
  245. -- load it to the humanoid; get AnimationTrack
  246. currentAnimTrack = humanoid:LoadAnimation(anim)
  247. -- play the animation
  248. currentAnimTrack:Play(transitionTime)
  249. currentAnim = animName
  250. currentAnimInstance = anim
  251. -- set up keyframe name triggers
  252. if (currentAnimKeyframeHandler ~= nil) then
  253. currentAnimKeyframeHandler:disconnect()
  254. end
  255. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  256. end
  257. end
  258. -------------------------------------------------------------------------------------------
  259. -------------------------------------------------------------------------------------------
  260. local toolAnimName = ""
  261. local toolAnimTrack = nil
  262. local toolAnimInstance = nil
  263. local currentToolAnimKeyframeHandler = nil
  264. function toolKeyFrameReachedFunc(frameName)
  265. if (frameName == "End") then
  266. --print("Keyframe : ".. frameName)
  267. playToolAnimation(toolAnimName, 0.0, Humanoid)
  268. end
  269. end
  270. function playToolAnimation(animName, transitionTime, humanoid)
  271. local roll = math.random(1, animTable[animName].totalWeight)
  272. local origRoll = roll
  273. local idx = 1
  274. while (roll > animTable[animName][idx].weight) do
  275. roll = roll - animTable[animName][idx].weight
  276. idx = idx + 1
  277. end
  278. --print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  279. local anim = animTable[animName][idx].anim
  280. if (toolAnimInstance ~= anim) then
  281. if (toolAnimTrack ~= nil) then
  282. toolAnimTrack:Stop()
  283. toolAnimTrack:Destroy()
  284. transitionTime = 0
  285. end
  286. -- load it to the humanoid; get AnimationTrack
  287. toolAnimTrack = humanoid:LoadAnimation(anim)
  288. -- play the animation
  289. toolAnimTrack:Play(transitionTime)
  290. toolAnimName = animName
  291. toolAnimInstance = anim
  292. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  293. end
  294. end
  295. function stopToolAnimations()
  296. local oldAnim = toolAnimName
  297. if (currentToolAnimKeyframeHandler ~= nil) then
  298. currentToolAnimKeyframeHandler:disconnect()
  299. end
  300. toolAnimName = ""
  301. toolAnimInstance = nil
  302. if (toolAnimTrack ~= nil) then
  303. toolAnimTrack:Stop()
  304. toolAnimTrack:Destroy()
  305. toolAnimTrack = nil
  306. end
  307. return oldAnim
  308. end
  309. -------------------------------------------------------------------------------------------
  310. -------------------------------------------------------------------------------------------
  311. function onRunning(speed)
  312. if speed>0.01 then
  313. playAnimation("walk", 0.1, Humanoid)
  314. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
  315. setAnimationSpeed(speed / 14.5)
  316. end
  317. pose = "Running"
  318. else
  319. playAnimation("idle", 0.1, Humanoid)
  320. pose = "Standing"
  321. end
  322. end
  323. function onDied()
  324. pose = "Dead"
  325. end
  326. function onJumping()
  327. playAnimation("jump", 0.1, Humanoid)
  328. jumpAnimTime = jumpAnimDuration
  329. pose = "Jumping"
  330. end
  331. function onClimbing(speed)
  332. playAnimation("climb", 0.1, Humanoid)
  333. setAnimationSpeed(speed / 12.0)
  334. pose = "Climbing"
  335. end
  336. function onGettingUp()
  337. pose = "GettingUp"
  338. end
  339. function onFreeFall()
  340. if (jumpAnimTime <= 0) then
  341. playAnimation("fall", fallTransitionTime, Humanoid)
  342. end
  343. pose = "FreeFall"
  344. end
  345. function onFallingDown()
  346. pose = "FallingDown"
  347. end
  348. function onSeated()
  349. pose = "Seated"
  350. end
  351. function onPlatformStanding()
  352. pose = "PlatformStanding"
  353. end
  354. function onSwimming(speed)
  355. if speed>0 then
  356. pose = "Running"
  357. else
  358. pose = "Standing"
  359. end
  360. end
  361.  
  362. function getTool()
  363. for _, kid in ipairs(Figure:GetChildren()) do
  364. if kid.className == "Tool" then return kid end
  365. end
  366. return nil
  367. end
  368.  
  369. function getToolAnim(tool)
  370. for _, c in ipairs(tool:GetChildren()) do
  371. if c.Name == "toolanim" and c.className == "StringValue" then
  372. return c
  373. end
  374. end
  375. return nil
  376. end
  377.  
  378. function animateTool()
  379.  
  380. if (toolAnim == "None") then
  381. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  382. return
  383. end
  384.  
  385. if (toolAnim == "Slash") then
  386. playToolAnimation("toolslash", 0, Humanoid)
  387. return
  388. end
  389.  
  390. if (toolAnim == "Lunge") then
  391. playToolAnimation("toollunge", 0, Humanoid)
  392. return
  393. end
  394. end
  395.  
  396. function moveSit()
  397. RightShoulder.MaxVelocity = 0.15
  398. LeftShoulder.MaxVelocity = 0.15
  399. RightShoulder:SetDesiredAngle(3.14 /2)
  400. LeftShoulder:SetDesiredAngle(-3.14 /2)
  401. RightHip:SetDesiredAngle(3.14 /2)
  402. LeftHip:SetDesiredAngle(-3.14 /2)
  403. end
  404.  
  405. local lastTick = 0
  406.  
  407. function move(time)
  408. local amplitude = 1
  409. local frequency = 1
  410. local deltaTime = time - lastTick
  411. lastTick = time
  412.  
  413. local climbFudge = 0
  414. local setAngles = false
  415.  
  416. if (jumpAnimTime > 0) then
  417. jumpAnimTime = jumpAnimTime - deltaTime
  418. end
  419.  
  420. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  421. playAnimation("fall", fallTransitionTime, Humanoid)
  422. elseif (pose == "Seated") then
  423. playAnimation("sit", 0.5, Humanoid)
  424. return
  425. elseif (pose == "Running") then
  426. playAnimation("walk", 0.1, Humanoid)
  427. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  428. stopAllAnimations()
  429. amplitude = 0.1
  430. frequency = 1
  431. setAngles = true
  432. end
  433. if (setAngles) then
  434. local desiredAngle = amplitude * math.sin(time * frequency)
  435. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  436. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  437. RightHip:SetDesiredAngle(-desiredAngle)
  438. LeftHip:SetDesiredAngle(-desiredAngle)
  439. end
  440. -- Tool Animation handling
  441. local tool = getTool()
  442. if tool and tool:FindFirstChild("Handle") then
  443. local animStringValueObject = getToolAnim(tool)
  444. if animStringValueObject then
  445. toolAnim = animStringValueObject.Value
  446. -- message recieved, delete StringValue
  447. animStringValueObject.Parent = nil
  448. toolAnimTime = time + .3
  449. end
  450. if time > toolAnimTime then
  451. toolAnimTime = 0
  452. toolAnim = "None"
  453. end
  454. animateTool()
  455. else
  456. stopToolAnimations()
  457. toolAnim = "None"
  458. toolAnimInstance = nil
  459. toolAnimTime = 0
  460. end
  461. end
  462. -- connect events
  463. Humanoid.Died:connect(onDied)
  464. Humanoid.Running:connect(onRunning)
  465. Humanoid.Jumping:connect(onJumping)
  466. Humanoid.Climbing:connect(onClimbing)
  467. Humanoid.GettingUp:connect(onGettingUp)
  468. Humanoid.FreeFalling:connect(onFreeFall)
  469. Humanoid.FallingDown:connect(onFallingDown)
  470. Humanoid.Seated:connect(onSeated)
  471. Humanoid.PlatformStanding:connect(onPlatformStanding)
  472. Humanoid.Swimming:connect(onSwimming)
  473. local runService = game:GetService("RunService");
  474. playAnimation("idle", 0.1, Humanoid)
  475. pose = "Standing"
  476. while Wait(0)do
  477. local _,time=wait(0)
  478. move(time)
  479. end end;
  480. function() function MakeBlood()
  481.  
  482. local blood = Instance.new("Part")
  483. blood.formFactor = "Plate"
  484. blood.Size = Vector3.new(1,0.4,1)
  485. blood.Name = "Blood"
  486. blood.BrickColor = BrickColor.new("Really red")
  487. blood.Locked = true
  488. blood.BackSurface = "Smooth"
  489. blood.TopSurface = "Smooth"
  490. blood.CanCollide = true
  491.  
  492. local CC = math.random(1,2)
  493.  
  494. if CC == 1 then
  495.  
  496. blood.Transparency = 0.5
  497.  
  498. elseif CC == 2 then
  499.  
  500. blood.Transparency = 0.3
  501.  
  502. end
  503.  
  504. blood.Position = script.Parent.Torso.Position
  505. blood.Parent = script.Parent
  506.  
  507. end
  508.  
  509. humanoid = script.Parent.Humanoid
  510. lhh = humanoid.Health
  511.  
  512. while true do
  513.  
  514. if humanoid.Health < lhh then
  515.  
  516. howmuch = math.random(4,7)
  517. lhh = humanoid.Health
  518.  
  519. for i = 1 , howmuch do
  520.  
  521. MakeBlood()
  522.  
  523. end
  524.  
  525. end
  526.  
  527. wait(0.1)
  528. end
  529. end;
  530. function() --[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]--
  531. local AdvancedRespawnScript=script;
  532. local Bob=AdvancedRespawnScript.Parent;
  533. local GameDerbis=Game:GetService("Debris");
  534. repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
  535. local BobHumanoid;
  536. for _,Child in pairs(Bob:GetChildren())do
  537. if Child and Child.ClassName=="Humanoid"and Child.Health>0.001 then
  538. BobHumanoid=Child;
  539. end;
  540. end;
  541. local Respawndant=Bob:Clone();
  542. coroutine.resume(coroutine.create(function()
  543. if Bob and BobHumanoid and BobHumanoid:FindFirstChild("Status")and not BobHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
  544. SpawnModel=Instance.new("Model");
  545. SpawnModel.Parent=BobHumanoid:FindFirstChild("Status");
  546. SpawnModel.Name="AvalibleSpawns";
  547. else
  548. SpawnModel=BobHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
  549. end;
  550. function FindSpawn(SearchValue)
  551. local PartsArchivable=SearchValue:GetChildren();
  552. for AreaSearch=1,#PartsArchivable do
  553. if PartsArchivable[AreaSearch].className=="SpawnLocation"then
  554. local PositionValue=Instance.new("Vector3Value",SpawnModel);
  555. PositionValue.Value=PartsArchivable[AreaSearch].Position;
  556. PositionValue.Name=PartsArchivable[AreaSearch].Duration;
  557. end;
  558. FindSpawn(PartsArchivable[AreaSearch]);
  559. end;
  560. end;
  561. FindSpawn(Game.Workspace);
  562. local SpawnChilden=SpawnModel:GetChildren();
  563. if#SpawnChilden>0 then
  564. local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
  565. local RespawningForceField=Instance.new("ForceField");
  566. RespawningForceField.Parent=Bob;
  567. RespawningForceField.Name="SpawnForceField";
  568. GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
  569. Bob:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
  570. else
  571. if Bob:FindFirstChild("SpawnForceField")then
  572. Bob:FindFirstChild("SpawnForceField"):Destroy();
  573. end;
  574. Bob:MoveTo(Vector3.new(0,115,0));
  575. end;
  576. end));
  577. function Respawn()
  578. Wait(5);
  579. Respawndant.Parent=Bob.Parent;
  580. Respawndant:MakeJoints();
  581. Respawndant:FindFirstChild("Head"):MakeJoints();
  582. Respawndant:FindFirstChild("Torso"):MakeJoints();
  583. Bob:remove();
  584. end;
  585. BobHumanoid.Died:connect(Respawn);
  586. --[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]-- end;
  587. function() function waitForChild(parent, childName)
  588. local child = parent:findFirstChild(childName)
  589. if child then return child end
  590. while true do
  591. child = parent.ChildAdded:wait()
  592. if child.Name==childName then return child end
  593. end
  594. end
  595.  
  596. local Figure = script.Parent
  597. local Torso = waitForChild(Figure, "Torso")
  598. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  599. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  600. local RightHip = waitForChild(Torso, "Right Hip")
  601. local LeftHip = waitForChild(Torso, "Left Hip")
  602. local Neck = waitForChild(Torso, "Neck")
  603. local Humanoid = waitForChild(Figure, "Humanoid")
  604. local pose = "Standing"
  605.  
  606. local currentAnim = ""
  607. local currentAnimInstance = nil
  608. local currentAnimTrack = nil
  609. local currentAnimKeyframeHandler = nil
  610. local currentAnimSpeed = 1.0
  611. local animTable = {}
  612. local animNames = {
  613. idle = {
  614. { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
  615. { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
  616. },
  617. walk = {
  618. { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
  619. },
  620. run = {
  621. { id = "run.xml", weight = 10 }
  622. },
  623. jump = {
  624. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  625. },
  626. fall = {
  627. { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
  628. },
  629. climb = {
  630. { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
  631. },
  632. sit = {
  633. { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
  634. },
  635. toolnone = {
  636. { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
  637. },
  638. toolslash = {
  639. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  640. -- { id = "slash.xml", weight = 10 }
  641. },
  642. toollunge = {
  643. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  644. },
  645. wave = {
  646. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  647. },
  648. point = {
  649. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  650. },
  651. dance1 = {
  652. { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
  653. { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
  654. { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
  655. },
  656. dance2 = {
  657. { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
  658. { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
  659. { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
  660. },
  661. dance3 = {
  662. { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
  663. { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
  664. { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
  665. },
  666. laugh = {
  667. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  668. },
  669. cheer = {
  670. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  671. },
  672. }
  673. local dances = {"dance1", "dance2", "dance3"}
  674.  
  675. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  676. local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  677.  
  678. function configureAnimationSet(name, fileList)
  679. if (animTable[name] ~= nil) then
  680. for _, connection in pairs(animTable[name].connections) do
  681. connection:disconnect()
  682. end
  683. end
  684. animTable[name] = {}
  685. animTable[name].count = 0
  686. animTable[name].totalWeight = 0
  687. animTable[name].connections = {}
  688.  
  689. -- check for config values
  690. local config = script:FindFirstChild(name)
  691. if (config ~= nil) then
  692. -- print("Loading anims " .. name)
  693. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  694. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  695. local idx = 1
  696. for _, childPart in pairs(config:GetChildren()) do
  697. if (childPart:IsA("Animation")) then
  698. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  699. animTable[name][idx] = {}
  700. animTable[name][idx].anim = childPart
  701. local weightObject = childPart:FindFirstChild("Weight")
  702. if (weightObject == nil) then
  703. animTable[name][idx].weight = 1
  704. else
  705. animTable[name][idx].weight = weightObject.Value
  706. end
  707. animTable[name].count = animTable[name].count + 1
  708. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  709. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  710. idx = idx + 1
  711. end
  712. end
  713. end
  714.  
  715. -- fallback to defaults
  716. if (animTable[name].count <= 0) then
  717. for idx, anim in pairs(fileList) do
  718. animTable[name][idx] = {}
  719. animTable[name][idx].anim = Instance.new("Animation")
  720. animTable[name][idx].anim.Name = name
  721. animTable[name][idx].anim.AnimationId = anim.id
  722. animTable[name][idx].weight = anim.weight
  723. animTable[name].count = animTable[name].count + 1
  724. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  725. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  726. end
  727. end
  728. end
  729.  
  730. -- Setup animation objects
  731. function scriptChildModified(child)
  732. local fileList = animNames[child.Name]
  733. if (fileList ~= nil) then
  734. configureAnimationSet(child.Name, fileList)
  735. end
  736. end
  737.  
  738. script.ChildAdded:connect(scriptChildModified)
  739. script.ChildRemoved:connect(scriptChildModified)
  740.  
  741.  
  742. for name, fileList in pairs(animNames) do
  743. configureAnimationSet(name, fileList)
  744. end
  745.  
  746. -- ANIMATION
  747.  
  748. -- declarations
  749. local toolAnim = "None"
  750. local toolAnimTime = 0
  751.  
  752. local jumpAnimTime = 0
  753. local jumpAnimDuration = 0.3
  754.  
  755. local toolTransitionTime = 0.1
  756. local fallTransitionTime = 0.3
  757. local jumpMaxLimbVelocity = 0.75
  758.  
  759. -- functions
  760.  
  761. function stopAllAnimations()
  762. local oldAnim = currentAnim
  763.  
  764. -- return to idle if finishing an emote
  765. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  766. oldAnim = "idle"
  767. end
  768.  
  769. currentAnim = ""
  770. currentAnimInstance = nil
  771. if (currentAnimKeyframeHandler ~= nil) then
  772. currentAnimKeyframeHandler:disconnect()
  773. end
  774.  
  775. if (currentAnimTrack ~= nil) then
  776. currentAnimTrack:Stop()
  777. currentAnimTrack:Destroy()
  778. currentAnimTrack = nil
  779. end
  780. return oldAnim
  781. end
  782.  
  783. function setAnimationSpeed(speed)
  784. if speed ~= currentAnimSpeed then
  785. currentAnimSpeed = speed
  786. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  787. end
  788. end
  789.  
  790. function keyFrameReachedFunc(frameName)
  791. if (frameName == "End") then
  792.  
  793. local repeatAnim = currentAnim
  794. -- return to idle if finishing an emote
  795. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  796. repeatAnim = "idle"
  797. end
  798.  
  799. local animSpeed = currentAnimSpeed
  800. playAnimation(repeatAnim, 0.0, Humanoid)
  801. setAnimationSpeed(animSpeed)
  802. end
  803. end
  804.  
  805. -- Preload animations
  806. function playAnimation(animName, transitionTime, humanoid)
  807.  
  808. local roll = math.random(1, animTable[animName].totalWeight)
  809. local origRoll = roll
  810. local idx = 1
  811. while (roll > animTable[animName][idx].weight) do
  812. roll = roll - animTable[animName][idx].weight
  813. idx = idx + 1
  814. end
  815. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  816. local anim = animTable[animName][idx].anim
  817.  
  818. -- switch animation
  819. if (anim ~= currentAnimInstance) then
  820.  
  821. if (currentAnimTrack ~= nil) then
  822. currentAnimTrack:Stop(transitionTime)
  823. currentAnimTrack:Destroy()
  824. end
  825.  
  826. currentAnimSpeed = 1.0
  827.  
  828. -- load it to the humanoid; get AnimationTrack
  829. currentAnimTrack = humanoid:LoadAnimation(anim)
  830.  
  831. -- play the animation
  832. currentAnimTrack:Play(transitionTime)
  833. currentAnim = animName
  834. currentAnimInstance = anim
  835.  
  836. -- set up keyframe name triggers
  837. if (currentAnimKeyframeHandler ~= nil) then
  838. currentAnimKeyframeHandler:disconnect()
  839. end
  840. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  841.  
  842. end
  843.  
  844. end
  845.  
  846. -------------------------------------------------------------------------------------------
  847. -------------------------------------------------------------------------------------------
  848.  
  849. local toolAnimName = ""
  850. local toolAnimTrack = nil
  851. local toolAnimInstance = nil
  852. local currentToolAnimKeyframeHandler = nil
  853.  
  854. function toolKeyFrameReachedFunc(frameName)
  855. if (frameName == "End") then
  856. -- print("Keyframe : ".. frameName)
  857. playToolAnimation(toolAnimName, 0.0, Humanoid)
  858. end
  859. end
  860.  
  861.  
  862. function playToolAnimation(animName, transitionTime, humanoid)
  863.  
  864. local roll = math.random(1, animTable[animName].totalWeight)
  865. local origRoll = roll
  866. local idx = 1
  867. while (roll > animTable[animName][idx].weight) do
  868. roll = roll - animTable[animName][idx].weight
  869. idx = idx + 1
  870. end
  871. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  872. local anim = animTable[animName][idx].anim
  873.  
  874. if (toolAnimInstance ~= anim) then
  875.  
  876. if (toolAnimTrack ~= nil) then
  877. toolAnimTrack:Stop()
  878. toolAnimTrack:Destroy()
  879. transitionTime = 0
  880. end
  881.  
  882. -- load it to the humanoid; get AnimationTrack
  883. toolAnimTrack = humanoid:LoadAnimation(anim)
  884.  
  885. -- play the animation
  886. toolAnimTrack:Play(transitionTime)
  887. toolAnimName = animName
  888. toolAnimInstance = anim
  889.  
  890. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  891. end
  892. end
  893.  
  894. function stopToolAnimations()
  895. local oldAnim = toolAnimName
  896.  
  897. if (currentToolAnimKeyframeHandler ~= nil) then
  898. currentToolAnimKeyframeHandler:disconnect()
  899. end
  900.  
  901. toolAnimName = ""
  902. toolAnimInstance = nil
  903. if (toolAnimTrack ~= nil) then
  904. toolAnimTrack:Stop()
  905. toolAnimTrack:Destroy()
  906. toolAnimTrack = nil
  907. end
  908.  
  909.  
  910. return oldAnim
  911. end
  912.  
  913. -------------------------------------------------------------------------------------------
  914. -------------------------------------------------------------------------------------------
  915.  
  916.  
  917. function onRunning(speed)
  918. if speed>0.01 then
  919. playAnimation("walk", 0.1, Humanoid)
  920. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
  921. setAnimationSpeed(speed / 14.5)
  922. end
  923. pose = "Running"
  924. else
  925. playAnimation("idle", 0.1, Humanoid)
  926. pose = "Standing"
  927. end
  928. end
  929.  
  930. function onDied()
  931. pose = "Dead"
  932. end
  933.  
  934. function onJumping()
  935. playAnimation("jump", 0.1, Humanoid)
  936. jumpAnimTime = jumpAnimDuration
  937. pose = "Jumping"
  938. end
  939.  
  940. function onClimbing(speed)
  941. playAnimation("climb", 0.1, Humanoid)
  942. setAnimationSpeed(speed / 12.0)
  943. pose = "Climbing"
  944. end
  945.  
  946. function onGettingUp()
  947. pose = "GettingUp"
  948. end
  949.  
  950. function onFreeFall()
  951. if (jumpAnimTime <= 0) then
  952. playAnimation("fall", fallTransitionTime, Humanoid)
  953. end
  954. pose = "FreeFall"
  955. end
  956.  
  957. function onFallingDown()
  958. pose = "FallingDown"
  959. end
  960.  
  961. function onSeated()
  962. pose = "Seated"
  963. end
  964.  
  965. function onPlatformStanding()
  966. pose = "PlatformStanding"
  967. end
  968.  
  969. function onSwimming(speed)
  970. if speed>0 then
  971. pose = "Running"
  972. else
  973. pose = "Standing"
  974. end
  975. end
  976.  
  977. function getTool()
  978. for _, kid in ipairs(Figure:GetChildren()) do
  979. if kid.className == "Tool" then return kid end
  980. end
  981. return nil
  982. end
  983.  
  984. function getToolAnim(tool)
  985. for _, c in ipairs(tool:GetChildren()) do
  986. if c.Name == "toolanim" and c.className == "StringValue" then
  987. return c
  988. end
  989. end
  990. return nil
  991. end
  992.  
  993. function animateTool()
  994.  
  995. if (toolAnim == "None") then
  996. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  997. return
  998. end
  999.  
  1000. if (toolAnim == "Slash") then
  1001. playToolAnimation("toolslash", 0, Humanoid)
  1002. return
  1003. end
  1004.  
  1005. if (toolAnim == "Lunge") then
  1006. playToolAnimation("toollunge", 0, Humanoid)
  1007. return
  1008. end
  1009. end
  1010.  
  1011. function moveSit()
  1012. RightShoulder.MaxVelocity = 0.15
  1013. LeftShoulder.MaxVelocity = 0.15
  1014. RightShoulder:SetDesiredAngle(3.14 /2)
  1015. LeftShoulder:SetDesiredAngle(-3.14 /2)
  1016. RightHip:SetDesiredAngle(3.14 /2)
  1017. LeftHip:SetDesiredAngle(-3.14 /2)
  1018. end
  1019.  
  1020. local lastTick = 0
  1021.  
  1022. function move(time)
  1023. local amplitude = 1
  1024. local frequency = 1
  1025. local deltaTime = time - lastTick
  1026. lastTick = time
  1027.  
  1028. local climbFudge = 0
  1029. local setAngles = false
  1030.  
  1031. if (jumpAnimTime > 0) then
  1032. jumpAnimTime = jumpAnimTime - deltaTime
  1033. end
  1034.  
  1035. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  1036. playAnimation("fall", fallTransitionTime, Humanoid)
  1037. elseif (pose == "Seated") then
  1038. playAnimation("sit", 0.5, Humanoid)
  1039. return
  1040. elseif (pose == "Running") then
  1041. playAnimation("walk", 0.1, Humanoid)
  1042. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  1043. -- print("Wha " .. pose)
  1044. stopAllAnimations()
  1045. amplitude = 0.1
  1046. frequency = 1
  1047. setAngles = true
  1048. end
  1049.  
  1050. if (setAngles) then
  1051. desiredAngle = amplitude * math.sin(time * frequency)
  1052.  
  1053. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  1054. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  1055. RightHip:SetDesiredAngle(-desiredAngle)
  1056. LeftHip:SetDesiredAngle(-desiredAngle)
  1057. end
  1058.  
  1059. -- Tool Animation handling
  1060. local tool = getTool()
  1061. if tool and tool:FindFirstChild("Handle") then
  1062.  
  1063. animStringValueObject = getToolAnim(tool)
  1064.  
  1065. if animStringValueObject then
  1066. toolAnim = animStringValueObject.Value
  1067. -- message recieved, delete StringValue
  1068. animStringValueObject.Parent = nil
  1069. toolAnimTime = time + .3
  1070. end
  1071.  
  1072. if time > toolAnimTime then
  1073. toolAnimTime = 0
  1074. toolAnim = "None"
  1075. end
  1076.  
  1077. animateTool()
  1078. else
  1079. stopToolAnimations()
  1080. toolAnim = "None"
  1081. toolAnimInstance = nil
  1082. toolAnimTime = 0
  1083. end
  1084. end
  1085.  
  1086. -- connect events
  1087. Humanoid.Died:connect(onDied)
  1088. Humanoid.Running:connect(onRunning)
  1089. Humanoid.Jumping:connect(onJumping)
  1090. Humanoid.Climbing:connect(onClimbing)
  1091. Humanoid.GettingUp:connect(onGettingUp)
  1092. Humanoid.FreeFalling:connect(onFreeFall)
  1093. Humanoid.FallingDown:connect(onFallingDown)
  1094. Humanoid.Seated:connect(onSeated)
  1095. Humanoid.PlatformStanding:connect(onPlatformStanding)
  1096. Humanoid.Swimming:connect(onSwimming)
  1097.  
  1098. -- setup emote chat hook
  1099. game.Players.LocalPlayer.Chatted:connect(function(msg)
  1100. local emote = ""
  1101. if msg == "/e dance" then
  1102. emote = dances[math.random(1, #dances)]
  1103. elseif (string.sub(msg, 1, 3) == "/e ") then
  1104. emote = string.sub(msg, 4)
  1105. elseif (string.sub(msg, 1, 7) == "/emote ") then
  1106. emote = string.sub(msg, 8)
  1107. end
  1108.  
  1109. if (pose == "Standing" and emoteNames[emote] ~= nil) then
  1110. playAnimation(emote, 0.1, Humanoid)
  1111. end
  1112.  
  1113. end)
  1114.  
  1115.  
  1116. -- main program
  1117.  
  1118. local runService = game:service("RunService");
  1119.  
  1120. -- initialize to idle
  1121. playAnimation("idle", 0.1, Humanoid)
  1122. pose = "Standing"
  1123.  
  1124. while Figure.Parent~=nil do
  1125. local _, time = wait(0.1)
  1126. move(time)
  1127. end
  1128.  
  1129.  
  1130. end;
  1131. function() -- Created by Quenty (@Quenty, follow me on twitter).
  1132. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  1133. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  1134.  
  1135. --[[ INSTRUCTIONS
  1136. - Place in the model
  1137. - Make sure model is anchored
  1138. - That's it. It will weld the model and all children.
  1139.  
  1140. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1141. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1142. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1143. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1144. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1145. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1146. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1147. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1148.  
  1149. 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.
  1150. ]]
  1151.  
  1152. --[[ DOCUMENTATION
  1153. - 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.
  1154. - Will work in PBS servers
  1155. - Will work as long as it starts out with the part anchored
  1156. - Stores the relative CFrame as a CFrame value
  1157. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  1158. - Utilizes a recursive algorith to find all parts in the model
  1159. - Will reweld on script reparent if the script is initially parented to a tool.
  1160. - Welds as fast as possible
  1161. ]]
  1162.  
  1163. -- qPerfectionWeld.lua
  1164. -- Created 10/6/2014
  1165. -- Author: Quenty
  1166. -- Version 1.0.3
  1167.  
  1168. -- Updated 10/14/2014 - Updated to 1.0.1
  1169. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  1170.  
  1171. -- Updated 10/14/2014 - Updated to 1.0.2
  1172. --- Fixed bug fix.
  1173.  
  1174. -- Updated 10/14/2014 - Updated to 1.0.3
  1175. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  1176.  
  1177. 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).
  1178.  
  1179.  
  1180. local function CallOnChildren(Instance, FunctionToCall)
  1181. -- Calls a function on each of the children of a certain object, using recursion.
  1182.  
  1183. FunctionToCall(Instance)
  1184.  
  1185. for _, Child in next, Instance:GetChildren() do
  1186. CallOnChildren(Child, FunctionToCall)
  1187. end
  1188. end
  1189.  
  1190. local function GetNearestParent(Instance, ClassName)
  1191. -- Returns the nearest parent of a certain class, or returns nil
  1192.  
  1193. local Ancestor = Instance
  1194. repeat
  1195. Ancestor = Ancestor.Parent
  1196. if Ancestor == nil then
  1197. return nil
  1198. end
  1199. until Ancestor:IsA(ClassName)
  1200.  
  1201. return Ancestor
  1202. end
  1203.  
  1204. local function GetBricks(StartInstance)
  1205. local List = {}
  1206.  
  1207. -- if StartInstance:IsA("BasePart") then
  1208. -- List[#List+1] = StartInstance
  1209. -- end
  1210.  
  1211. CallOnChildren(StartInstance, function(Item)
  1212. if Item:IsA("BasePart") then
  1213. List[#List+1] = Item;
  1214. end
  1215. end)
  1216.  
  1217. return List
  1218. end
  1219.  
  1220. local function Modify(Instance, Values)
  1221. -- Modifies an Instance by using a table.
  1222.  
  1223. assert(type(Values) == "table", "Values is not a table");
  1224.  
  1225. for Index, Value in next, Values do
  1226. if type(Index) == "number" then
  1227. Value.Parent = Instance
  1228. else
  1229. Instance[Index] = Value
  1230. end
  1231. end
  1232. return Instance
  1233. end
  1234.  
  1235. local function Make(ClassType, Properties)
  1236. -- Using a syntax hack to create a nice way to Make new items.
  1237.  
  1238. return Modify(Instance.new(ClassType), Properties)
  1239. end
  1240.  
  1241. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  1242. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  1243.  
  1244. local function HasWheelJoint(Part)
  1245. for _, SurfaceName in pairs(Surfaces) do
  1246. for _, HingSurfaceName in pairs(HingSurfaces) do
  1247. if Part[SurfaceName].Name == HingSurfaceName then
  1248. return true
  1249. end
  1250. end
  1251. end
  1252.  
  1253. return false
  1254. end
  1255.  
  1256. local function ShouldBreakJoints(Part)
  1257. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  1258. -- definitely some edge cases.
  1259.  
  1260. if NEVER_BREAK_JOINTS then
  1261. return false
  1262. end
  1263.  
  1264. if HasWheelJoint(Part) then
  1265. return false
  1266. end
  1267.  
  1268. local Connected = Part:GetConnectedParts()
  1269.  
  1270. if #Connected == 1 then
  1271. return false
  1272. end
  1273.  
  1274. for _, Item in pairs(Connected) do
  1275. if HasWheelJoint(Item) then
  1276. return false
  1277. elseif not Item:IsDescendantOf(script.Parent) then
  1278. return false
  1279. end
  1280. end
  1281.  
  1282. return true
  1283. end
  1284.  
  1285. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  1286. --- Weld's 2 parts together
  1287. -- @param Part0 The first part
  1288. -- @param Part1 The second part (Dependent part most of the time).
  1289. -- @param [JointType] The type of joint. Defaults to weld.
  1290. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  1291. -- @return The weld created.
  1292.  
  1293. JointType = JointType or "Weld"
  1294. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  1295.  
  1296. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  1297. Modify(NewWeld, {
  1298. Name = "qCFrameWeldThingy";
  1299. Part0 = Part0;
  1300. Part1 = Part1;
  1301. C0 = CFrame.new();--Part0.CFrame:inverse();
  1302. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  1303. Parent = Part1;
  1304. })
  1305.  
  1306. if not RelativeValue then
  1307. RelativeValue = Make("CFrameValue", {
  1308. Parent = Part1;
  1309. Name = "qRelativeCFrameWeldValue";
  1310. Archivable = true;
  1311. Value = NewWeld.C1;
  1312. })
  1313. end
  1314.  
  1315. return NewWeld
  1316. end
  1317.  
  1318. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  1319. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  1320. -- @param MainPart The part to weld the model to (can be in the model).
  1321. -- @param [JointType] The type of joint. Defaults to weld.
  1322. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  1323.  
  1324. for _, Part in pairs(Parts) do
  1325. if ShouldBreakJoints(Part) then
  1326. Part:BreakJoints()
  1327. end
  1328. end
  1329.  
  1330. for _, Part in pairs(Parts) do
  1331. if Part ~= MainPart then
  1332. WeldTogether(MainPart, Part, JointType, MainPart)
  1333. end
  1334. end
  1335.  
  1336. if not DoNotUnanchor then
  1337. for _, Part in pairs(Parts) do
  1338. Part.Anchored = false
  1339. end
  1340. MainPart.Anchored = false
  1341. end
  1342. end
  1343.  
  1344. local function PerfectionWeld()
  1345. local Tool = GetNearestParent(script, "Tool")
  1346.  
  1347. local Parts = GetBricks(script.Parent)
  1348. 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]
  1349.  
  1350. if PrimaryPart then
  1351. WeldParts(Parts, PrimaryPart, "Weld", false)
  1352. else
  1353. warn("qWeld - Unable to weld part")
  1354. end
  1355.  
  1356. return Tool
  1357. end
  1358.  
  1359. local Tool = PerfectionWeld()
  1360.  
  1361.  
  1362. if Tool and script.ClassName == "Script" then
  1363. --- Don't bother with local scripts
  1364.  
  1365. script.Parent.AncestryChanged:connect(function()
  1366. PerfectionWeld()
  1367. end)
  1368. end
  1369.  
  1370. -- Created by Quenty (@Quenty, follow me on twitter).
  1371. end;
  1372. function() -- Created by Quenty (@Quenty, follow me on twitter).
  1373. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  1374. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  1375.  
  1376. --[[ INSTRUCTIONS
  1377. - Place in the model
  1378. - Make sure model is anchored
  1379. - That's it. It will weld the model and all children.
  1380.  
  1381. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1382. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1383. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1384. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1385. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1386. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1387. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1388. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1389.  
  1390. 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.
  1391. ]]
  1392.  
  1393. --[[ DOCUMENTATION
  1394. - 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.
  1395. - Will work in PBS servers
  1396. - Will work as long as it starts out with the part anchored
  1397. - Stores the relative CFrame as a CFrame value
  1398. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  1399. - Utilizes a recursive algorith to find all parts in the model
  1400. - Will reweld on script reparent if the script is initially parented to a tool.
  1401. - Welds as fast as possible
  1402. ]]
  1403.  
  1404. -- qPerfectionWeld.lua
  1405. -- Created 10/6/2014
  1406. -- Author: Quenty
  1407. -- Version 1.0.3
  1408.  
  1409. -- Updated 10/14/2014 - Updated to 1.0.1
  1410. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  1411.  
  1412. -- Updated 10/14/2014 - Updated to 1.0.2
  1413. --- Fixed bug fix.
  1414.  
  1415. -- Updated 10/14/2014 - Updated to 1.0.3
  1416. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  1417.  
  1418. 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).
  1419.  
  1420.  
  1421. local function CallOnChildren(Instance, FunctionToCall)
  1422. -- Calls a function on each of the children of a certain object, using recursion.
  1423.  
  1424. FunctionToCall(Instance)
  1425.  
  1426. for _, Child in next, Instance:GetChildren() do
  1427. CallOnChildren(Child, FunctionToCall)
  1428. end
  1429. end
  1430.  
  1431. local function GetNearestParent(Instance, ClassName)
  1432. -- Returns the nearest parent of a certain class, or returns nil
  1433.  
  1434. local Ancestor = Instance
  1435. repeat
  1436. Ancestor = Ancestor.Parent
  1437. if Ancestor == nil then
  1438. return nil
  1439. end
  1440. until Ancestor:IsA(ClassName)
  1441.  
  1442. return Ancestor
  1443. end
  1444.  
  1445. local function GetBricks(StartInstance)
  1446. local List = {}
  1447.  
  1448. -- if StartInstance:IsA("BasePart") then
  1449. -- List[#List+1] = StartInstance
  1450. -- end
  1451.  
  1452. CallOnChildren(StartInstance, function(Item)
  1453. if Item:IsA("BasePart") then
  1454. List[#List+1] = Item;
  1455. end
  1456. end)
  1457.  
  1458. return List
  1459. end
  1460.  
  1461. local function Modify(Instance, Values)
  1462. -- Modifies an Instance by using a table.
  1463.  
  1464. assert(type(Values) == "table", "Values is not a table");
  1465.  
  1466. for Index, Value in next, Values do
  1467. if type(Index) == "number" then
  1468. Value.Parent = Instance
  1469. else
  1470. Instance[Index] = Value
  1471. end
  1472. end
  1473. return Instance
  1474. end
  1475.  
  1476. local function Make(ClassType, Properties)
  1477. -- Using a syntax hack to create a nice way to Make new items.
  1478.  
  1479. return Modify(Instance.new(ClassType), Properties)
  1480. end
  1481.  
  1482. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  1483. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  1484.  
  1485. local function HasWheelJoint(Part)
  1486. for _, SurfaceName in pairs(Surfaces) do
  1487. for _, HingSurfaceName in pairs(HingSurfaces) do
  1488. if Part[SurfaceName].Name == HingSurfaceName then
  1489. return true
  1490. end
  1491. end
  1492. end
  1493.  
  1494. return false
  1495. end
  1496.  
  1497. local function ShouldBreakJoints(Part)
  1498. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  1499. -- definitely some edge cases.
  1500.  
  1501. if NEVER_BREAK_JOINTS then
  1502. return false
  1503. end
  1504.  
  1505. if HasWheelJoint(Part) then
  1506. return false
  1507. end
  1508.  
  1509. local Connected = Part:GetConnectedParts()
  1510.  
  1511. if #Connected == 1 then
  1512. return false
  1513. end
  1514.  
  1515. for _, Item in pairs(Connected) do
  1516. if HasWheelJoint(Item) then
  1517. return false
  1518. elseif not Item:IsDescendantOf(script.Parent) then
  1519. return false
  1520. end
  1521. end
  1522.  
  1523. return true
  1524. end
  1525.  
  1526. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  1527. --- Weld's 2 parts together
  1528. -- @param Part0 The first part
  1529. -- @param Part1 The second part (Dependent part most of the time).
  1530. -- @param [JointType] The type of joint. Defaults to weld.
  1531. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  1532. -- @return The weld created.
  1533.  
  1534. JointType = JointType or "Weld"
  1535. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  1536.  
  1537. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  1538. Modify(NewWeld, {
  1539. Name = "qCFrameWeldThingy";
  1540. Part0 = Part0;
  1541. Part1 = Part1;
  1542. C0 = CFrame.new();--Part0.CFrame:inverse();
  1543. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  1544. Parent = Part1;
  1545. })
  1546.  
  1547. if not RelativeValue then
  1548. RelativeValue = Make("CFrameValue", {
  1549. Parent = Part1;
  1550. Name = "qRelativeCFrameWeldValue";
  1551. Archivable = true;
  1552. Value = NewWeld.C1;
  1553. })
  1554. end
  1555.  
  1556. return NewWeld
  1557. end
  1558.  
  1559. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  1560. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  1561. -- @param MainPart The part to weld the model to (can be in the model).
  1562. -- @param [JointType] The type of joint. Defaults to weld.
  1563. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  1564.  
  1565. for _, Part in pairs(Parts) do
  1566. if ShouldBreakJoints(Part) then
  1567. Part:BreakJoints()
  1568. end
  1569. end
  1570.  
  1571. for _, Part in pairs(Parts) do
  1572. if Part ~= MainPart then
  1573. WeldTogether(MainPart, Part, JointType, MainPart)
  1574. end
  1575. end
  1576.  
  1577. if not DoNotUnanchor then
  1578. for _, Part in pairs(Parts) do
  1579. Part.Anchored = false
  1580. end
  1581. MainPart.Anchored = false
  1582. end
  1583. end
  1584.  
  1585. local function PerfectionWeld()
  1586. local Tool = GetNearestParent(script, "Tool")
  1587.  
  1588. local Parts = GetBricks(script.Parent)
  1589. 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]
  1590.  
  1591. if PrimaryPart then
  1592. WeldParts(Parts, PrimaryPart, "Weld", false)
  1593. else
  1594. warn("qWeld - Unable to weld part")
  1595. end
  1596.  
  1597. return Tool
  1598. end
  1599.  
  1600. local Tool = PerfectionWeld()
  1601.  
  1602.  
  1603. if Tool and script.ClassName == "Script" then
  1604. --- Don't bother with local scripts
  1605.  
  1606. script.Parent.AncestryChanged:connect(function()
  1607. PerfectionWeld()
  1608. end)
  1609. end
  1610.  
  1611. -- Created by Quenty (@Quenty, follow me on twitter).
  1612. end;
  1613. function() -- Created by Quenty (@Quenty, follow me on twitter).
  1614. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  1615. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  1616.  
  1617. --[[ INSTRUCTIONS
  1618. - Place in the model
  1619. - Make sure model is anchored
  1620. - That's it. It will weld the model and all children.
  1621.  
  1622. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1623. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1624. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1625. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1626. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1627. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1628. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1629. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1630.  
  1631. 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.
  1632. ]]
  1633.  
  1634. --[[ DOCUMENTATION
  1635. - 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.
  1636. - Will work in PBS servers
  1637. - Will work as long as it starts out with the part anchored
  1638. - Stores the relative CFrame as a CFrame value
  1639. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  1640. - Utilizes a recursive algorith to find all parts in the model
  1641. - Will reweld on script reparent if the script is initially parented to a tool.
  1642. - Welds as fast as possible
  1643. ]]
  1644.  
  1645. -- qPerfectionWeld.lua
  1646. -- Created 10/6/2014
  1647. -- Author: Quenty
  1648. -- Version 1.0.3
  1649.  
  1650. -- Updated 10/14/2014 - Updated to 1.0.1
  1651. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  1652.  
  1653. -- Updated 10/14/2014 - Updated to 1.0.2
  1654. --- Fixed bug fix.
  1655.  
  1656. -- Updated 10/14/2014 - Updated to 1.0.3
  1657. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  1658.  
  1659. 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).
  1660.  
  1661.  
  1662. local function CallOnChildren(Instance, FunctionToCall)
  1663. -- Calls a function on each of the children of a certain object, using recursion.
  1664.  
  1665. FunctionToCall(Instance)
  1666.  
  1667. for _, Child in next, Instance:GetChildren() do
  1668. CallOnChildren(Child, FunctionToCall)
  1669. end
  1670. end
  1671.  
  1672. local function GetNearestParent(Instance, ClassName)
  1673. -- Returns the nearest parent of a certain class, or returns nil
  1674.  
  1675. local Ancestor = Instance
  1676. repeat
  1677. Ancestor = Ancestor.Parent
  1678. if Ancestor == nil then
  1679. return nil
  1680. end
  1681. until Ancestor:IsA(ClassName)
  1682.  
  1683. return Ancestor
  1684. end
  1685.  
  1686. local function GetBricks(StartInstance)
  1687. local List = {}
  1688.  
  1689. -- if StartInstance:IsA("BasePart") then
  1690. -- List[#List+1] = StartInstance
  1691. -- end
  1692.  
  1693. CallOnChildren(StartInstance, function(Item)
  1694. if Item:IsA("BasePart") then
  1695. List[#List+1] = Item;
  1696. end
  1697. end)
  1698.  
  1699. return List
  1700. end
  1701.  
  1702. local function Modify(Instance, Values)
  1703. -- Modifies an Instance by using a table.
  1704.  
  1705. assert(type(Values) == "table", "Values is not a table");
  1706.  
  1707. for Index, Value in next, Values do
  1708. if type(Index) == "number" then
  1709. Value.Parent = Instance
  1710. else
  1711. Instance[Index] = Value
  1712. end
  1713. end
  1714. return Instance
  1715. end
  1716.  
  1717. local function Make(ClassType, Properties)
  1718. -- Using a syntax hack to create a nice way to Make new items.
  1719.  
  1720. return Modify(Instance.new(ClassType), Properties)
  1721. end
  1722.  
  1723. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  1724. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  1725.  
  1726. local function HasWheelJoint(Part)
  1727. for _, SurfaceName in pairs(Surfaces) do
  1728. for _, HingSurfaceName in pairs(HingSurfaces) do
  1729. if Part[SurfaceName].Name == HingSurfaceName then
  1730. return true
  1731. end
  1732. end
  1733. end
  1734.  
  1735. return false
  1736. end
  1737.  
  1738. local function ShouldBreakJoints(Part)
  1739. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  1740. -- definitely some edge cases.
  1741.  
  1742. if NEVER_BREAK_JOINTS then
  1743. return false
  1744. end
  1745.  
  1746. if HasWheelJoint(Part) then
  1747. return false
  1748. end
  1749.  
  1750. local Connected = Part:GetConnectedParts()
  1751.  
  1752. if #Connected == 1 then
  1753. return false
  1754. end
  1755.  
  1756. for _, Item in pairs(Connected) do
  1757. if HasWheelJoint(Item) then
  1758. return false
  1759. elseif not Item:IsDescendantOf(script.Parent) then
  1760. return false
  1761. end
  1762. end
  1763.  
  1764. return true
  1765. end
  1766.  
  1767. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  1768. --- Weld's 2 parts together
  1769. -- @param Part0 The first part
  1770. -- @param Part1 The second part (Dependent part most of the time).
  1771. -- @param [JointType] The type of joint. Defaults to weld.
  1772. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  1773. -- @return The weld created.
  1774.  
  1775. JointType = JointType or "Weld"
  1776. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  1777.  
  1778. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  1779. Modify(NewWeld, {
  1780. Name = "qCFrameWeldThingy";
  1781. Part0 = Part0;
  1782. Part1 = Part1;
  1783. C0 = CFrame.new();--Part0.CFrame:inverse();
  1784. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  1785. Parent = Part1;
  1786. })
  1787.  
  1788. if not RelativeValue then
  1789. RelativeValue = Make("CFrameValue", {
  1790. Parent = Part1;
  1791. Name = "qRelativeCFrameWeldValue";
  1792. Archivable = true;
  1793. Value = NewWeld.C1;
  1794. })
  1795. end
  1796.  
  1797. return NewWeld
  1798. end
  1799.  
  1800. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  1801. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  1802. -- @param MainPart The part to weld the model to (can be in the model).
  1803. -- @param [JointType] The type of joint. Defaults to weld.
  1804. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  1805.  
  1806. for _, Part in pairs(Parts) do
  1807. if ShouldBreakJoints(Part) then
  1808. Part:BreakJoints()
  1809. end
  1810. end
  1811.  
  1812. for _, Part in pairs(Parts) do
  1813. if Part ~= MainPart then
  1814. WeldTogether(MainPart, Part, JointType, MainPart)
  1815. end
  1816. end
  1817.  
  1818. if not DoNotUnanchor then
  1819. for _, Part in pairs(Parts) do
  1820. Part.Anchored = false
  1821. end
  1822. MainPart.Anchored = false
  1823. end
  1824. end
  1825.  
  1826. local function PerfectionWeld()
  1827. local Tool = GetNearestParent(script, "Tool")
  1828.  
  1829. local Parts = GetBricks(script.Parent)
  1830. 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]
  1831.  
  1832. if PrimaryPart then
  1833. WeldParts(Parts, PrimaryPart, "Weld", false)
  1834. else
  1835. warn("qWeld - Unable to weld part")
  1836. end
  1837.  
  1838. return Tool
  1839. end
  1840.  
  1841. local Tool = PerfectionWeld()
  1842.  
  1843.  
  1844. if Tool and script.ClassName == "Script" then
  1845. --- Don't bother with local scripts
  1846.  
  1847. script.Parent.AncestryChanged:connect(function()
  1848. PerfectionWeld()
  1849. end)
  1850. end
  1851.  
  1852. -- Created by Quenty (@Quenty, follow me on twitter).
  1853. end;
  1854. function() -- Created by Quenty (@Quenty, follow me on twitter).
  1855. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  1856. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  1857.  
  1858. --[[ INSTRUCTIONS
  1859. - Place in the model
  1860. - Make sure model is anchored
  1861. - That's it. It will weld the model and all children.
  1862.  
  1863. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1864. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1865. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1866. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1867. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1868. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1869. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1870. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  1871.  
  1872. 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.
  1873. ]]
  1874.  
  1875. --[[ DOCUMENTATION
  1876. - 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.
  1877. - Will work in PBS servers
  1878. - Will work as long as it starts out with the part anchored
  1879. - Stores the relative CFrame as a CFrame value
  1880. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  1881. - Utilizes a recursive algorith to find all parts in the model
  1882. - Will reweld on script reparent if the script is initially parented to a tool.
  1883. - Welds as fast as possible
  1884. ]]
  1885.  
  1886. -- qPerfectionWeld.lua
  1887. -- Created 10/6/2014
  1888. -- Author: Quenty
  1889. -- Version 1.0.3
  1890.  
  1891. -- Updated 10/14/2014 - Updated to 1.0.1
  1892. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  1893.  
  1894. -- Updated 10/14/2014 - Updated to 1.0.2
  1895. --- Fixed bug fix.
  1896.  
  1897. -- Updated 10/14/2014 - Updated to 1.0.3
  1898. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  1899.  
  1900. 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).
  1901.  
  1902.  
  1903. local function CallOnChildren(Instance, FunctionToCall)
  1904. -- Calls a function on each of the children of a certain object, using recursion.
  1905.  
  1906. FunctionToCall(Instance)
  1907.  
  1908. for _, Child in next, Instance:GetChildren() do
  1909. CallOnChildren(Child, FunctionToCall)
  1910. end
  1911. end
  1912.  
  1913. local function GetNearestParent(Instance, ClassName)
  1914. -- Returns the nearest parent of a certain class, or returns nil
  1915.  
  1916. local Ancestor = Instance
  1917. repeat
  1918. Ancestor = Ancestor.Parent
  1919. if Ancestor == nil then
  1920. return nil
  1921. end
  1922. until Ancestor:IsA(ClassName)
  1923.  
  1924. return Ancestor
  1925. end
  1926.  
  1927. local function GetBricks(StartInstance)
  1928. local List = {}
  1929.  
  1930. -- if StartInstance:IsA("BasePart") then
  1931. -- List[#List+1] = StartInstance
  1932. -- end
  1933.  
  1934. CallOnChildren(StartInstance, function(Item)
  1935. if Item:IsA("BasePart") then
  1936. List[#List+1] = Item;
  1937. end
  1938. end)
  1939.  
  1940. return List
  1941. end
  1942.  
  1943. local function Modify(Instance, Values)
  1944. -- Modifies an Instance by using a table.
  1945.  
  1946. assert(type(Values) == "table", "Values is not a table");
  1947.  
  1948. for Index, Value in next, Values do
  1949. if type(Index) == "number" then
  1950. Value.Parent = Instance
  1951. else
  1952. Instance[Index] = Value
  1953. end
  1954. end
  1955. return Instance
  1956. end
  1957.  
  1958. local function Make(ClassType, Properties)
  1959. -- Using a syntax hack to create a nice way to Make new items.
  1960.  
  1961. return Modify(Instance.new(ClassType), Properties)
  1962. end
  1963.  
  1964. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  1965. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  1966.  
  1967. local function HasWheelJoint(Part)
  1968. for _, SurfaceName in pairs(Surfaces) do
  1969. for _, HingSurfaceName in pairs(HingSurfaces) do
  1970. if Part[SurfaceName].Name == HingSurfaceName then
  1971. return true
  1972. end
  1973. end
  1974. end
  1975.  
  1976. return false
  1977. end
  1978.  
  1979. local function ShouldBreakJoints(Part)
  1980. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  1981. -- definitely some edge cases.
  1982.  
  1983. if NEVER_BREAK_JOINTS then
  1984. return false
  1985. end
  1986.  
  1987. if HasWheelJoint(Part) then
  1988. return false
  1989. end
  1990.  
  1991. local Connected = Part:GetConnectedParts()
  1992.  
  1993. if #Connected == 1 then
  1994. return false
  1995. end
  1996.  
  1997. for _, Item in pairs(Connected) do
  1998. if HasWheelJoint(Item) then
  1999. return false
  2000. elseif not Item:IsDescendantOf(script.Parent) then
  2001. return false
  2002. end
  2003. end
  2004.  
  2005. return true
  2006. end
  2007.  
  2008. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  2009. --- Weld's 2 parts together
  2010. -- @param Part0 The first part
  2011. -- @param Part1 The second part (Dependent part most of the time).
  2012. -- @param [JointType] The type of joint. Defaults to weld.
  2013. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  2014. -- @return The weld created.
  2015.  
  2016. JointType = JointType or "Weld"
  2017. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  2018.  
  2019. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  2020. Modify(NewWeld, {
  2021. Name = "qCFrameWeldThingy";
  2022. Part0 = Part0;
  2023. Part1 = Part1;
  2024. C0 = CFrame.new();--Part0.CFrame:inverse();
  2025. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  2026. Parent = Part1;
  2027. })
  2028.  
  2029. if not RelativeValue then
  2030. RelativeValue = Make("CFrameValue", {
  2031. Parent = Part1;
  2032. Name = "qRelativeCFrameWeldValue";
  2033. Archivable = true;
  2034. Value = NewWeld.C1;
  2035. })
  2036. end
  2037.  
  2038. return NewWeld
  2039. end
  2040.  
  2041. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  2042. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  2043. -- @param MainPart The part to weld the model to (can be in the model).
  2044. -- @param [JointType] The type of joint. Defaults to weld.
  2045. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  2046.  
  2047. for _, Part in pairs(Parts) do
  2048. if ShouldBreakJoints(Part) then
  2049. Part:BreakJoints()
  2050. end
  2051. end
  2052.  
  2053. for _, Part in pairs(Parts) do
  2054. if Part ~= MainPart then
  2055. WeldTogether(MainPart, Part, JointType, MainPart)
  2056. end
  2057. end
  2058.  
  2059. if not DoNotUnanchor then
  2060. for _, Part in pairs(Parts) do
  2061. Part.Anchored = false
  2062. end
  2063. MainPart.Anchored = false
  2064. end
  2065. end
  2066.  
  2067. local function PerfectionWeld()
  2068. local Tool = GetNearestParent(script, "Tool")
  2069.  
  2070. local Parts = GetBricks(script.Parent)
  2071. 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]
  2072.  
  2073. if PrimaryPart then
  2074. WeldParts(Parts, PrimaryPart, "Weld", false)
  2075. else
  2076. warn("qWeld - Unable to weld part")
  2077. end
  2078.  
  2079. return Tool
  2080. end
  2081.  
  2082. local Tool = PerfectionWeld()
  2083.  
  2084.  
  2085. if Tool and script.ClassName == "Script" then
  2086. --- Don't bother with local scripts
  2087.  
  2088. script.Parent.AncestryChanged:connect(function()
  2089. PerfectionWeld()
  2090. end)
  2091. end
  2092.  
  2093. -- Created by Quenty (@Quenty, follow me on twitter).
  2094. end;
  2095. function() -- Created by Quenty (@Quenty, follow me on twitter).
  2096. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  2097. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  2098.  
  2099. --[[ INSTRUCTIONS
  2100. - Place in the model
  2101. - Make sure model is anchored
  2102. - That's it. It will weld the model and all children.
  2103.  
  2104. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2105. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2106. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2107. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2108. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2109. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2110. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2111. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2112.  
  2113. 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.
  2114. ]]
  2115.  
  2116. --[[ DOCUMENTATION
  2117. - 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.
  2118. - Will work in PBS servers
  2119. - Will work as long as it starts out with the part anchored
  2120. - Stores the relative CFrame as a CFrame value
  2121. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  2122. - Utilizes a recursive algorith to find all parts in the model
  2123. - Will reweld on script reparent if the script is initially parented to a tool.
  2124. - Welds as fast as possible
  2125. ]]
  2126.  
  2127. -- qPerfectionWeld.lua
  2128. -- Created 10/6/2014
  2129. -- Author: Quenty
  2130. -- Version 1.0.3
  2131.  
  2132. -- Updated 10/14/2014 - Updated to 1.0.1
  2133. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  2134.  
  2135. -- Updated 10/14/2014 - Updated to 1.0.2
  2136. --- Fixed bug fix.
  2137.  
  2138. -- Updated 10/14/2014 - Updated to 1.0.3
  2139. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  2140.  
  2141. 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).
  2142.  
  2143.  
  2144. local function CallOnChildren(Instance, FunctionToCall)
  2145. -- Calls a function on each of the children of a certain object, using recursion.
  2146.  
  2147. FunctionToCall(Instance)
  2148.  
  2149. for _, Child in next, Instance:GetChildren() do
  2150. CallOnChildren(Child, FunctionToCall)
  2151. end
  2152. end
  2153.  
  2154. local function GetNearestParent(Instance, ClassName)
  2155. -- Returns the nearest parent of a certain class, or returns nil
  2156.  
  2157. local Ancestor = Instance
  2158. repeat
  2159. Ancestor = Ancestor.Parent
  2160. if Ancestor == nil then
  2161. return nil
  2162. end
  2163. until Ancestor:IsA(ClassName)
  2164.  
  2165. return Ancestor
  2166. end
  2167.  
  2168. local function GetBricks(StartInstance)
  2169. local List = {}
  2170.  
  2171. -- if StartInstance:IsA("BasePart") then
  2172. -- List[#List+1] = StartInstance
  2173. -- end
  2174.  
  2175. CallOnChildren(StartInstance, function(Item)
  2176. if Item:IsA("BasePart") then
  2177. List[#List+1] = Item;
  2178. end
  2179. end)
  2180.  
  2181. return List
  2182. end
  2183.  
  2184. local function Modify(Instance, Values)
  2185. -- Modifies an Instance by using a table.
  2186.  
  2187. assert(type(Values) == "table", "Values is not a table");
  2188.  
  2189. for Index, Value in next, Values do
  2190. if type(Index) == "number" then
  2191. Value.Parent = Instance
  2192. else
  2193. Instance[Index] = Value
  2194. end
  2195. end
  2196. return Instance
  2197. end
  2198.  
  2199. local function Make(ClassType, Properties)
  2200. -- Using a syntax hack to create a nice way to Make new items.
  2201.  
  2202. return Modify(Instance.new(ClassType), Properties)
  2203. end
  2204.  
  2205. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  2206. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  2207.  
  2208. local function HasWheelJoint(Part)
  2209. for _, SurfaceName in pairs(Surfaces) do
  2210. for _, HingSurfaceName in pairs(HingSurfaces) do
  2211. if Part[SurfaceName].Name == HingSurfaceName then
  2212. return true
  2213. end
  2214. end
  2215. end
  2216.  
  2217. return false
  2218. end
  2219.  
  2220. local function ShouldBreakJoints(Part)
  2221. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  2222. -- definitely some edge cases.
  2223.  
  2224. if NEVER_BREAK_JOINTS then
  2225. return false
  2226. end
  2227.  
  2228. if HasWheelJoint(Part) then
  2229. return false
  2230. end
  2231.  
  2232. local Connected = Part:GetConnectedParts()
  2233.  
  2234. if #Connected == 1 then
  2235. return false
  2236. end
  2237.  
  2238. for _, Item in pairs(Connected) do
  2239. if HasWheelJoint(Item) then
  2240. return false
  2241. elseif not Item:IsDescendantOf(script.Parent) then
  2242. return false
  2243. end
  2244. end
  2245.  
  2246. return true
  2247. end
  2248.  
  2249. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  2250. --- Weld's 2 parts together
  2251. -- @param Part0 The first part
  2252. -- @param Part1 The second part (Dependent part most of the time).
  2253. -- @param [JointType] The type of joint. Defaults to weld.
  2254. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  2255. -- @return The weld created.
  2256.  
  2257. JointType = JointType or "Weld"
  2258. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  2259.  
  2260. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  2261. Modify(NewWeld, {
  2262. Name = "qCFrameWeldThingy";
  2263. Part0 = Part0;
  2264. Part1 = Part1;
  2265. C0 = CFrame.new();--Part0.CFrame:inverse();
  2266. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  2267. Parent = Part1;
  2268. })
  2269.  
  2270. if not RelativeValue then
  2271. RelativeValue = Make("CFrameValue", {
  2272. Parent = Part1;
  2273. Name = "qRelativeCFrameWeldValue";
  2274. Archivable = true;
  2275. Value = NewWeld.C1;
  2276. })
  2277. end
  2278.  
  2279. return NewWeld
  2280. end
  2281.  
  2282. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  2283. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  2284. -- @param MainPart The part to weld the model to (can be in the model).
  2285. -- @param [JointType] The type of joint. Defaults to weld.
  2286. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  2287.  
  2288. for _, Part in pairs(Parts) do
  2289. if ShouldBreakJoints(Part) then
  2290. Part:BreakJoints()
  2291. end
  2292. end
  2293.  
  2294. for _, Part in pairs(Parts) do
  2295. if Part ~= MainPart then
  2296. WeldTogether(MainPart, Part, JointType, MainPart)
  2297. end
  2298. end
  2299.  
  2300. if not DoNotUnanchor then
  2301. for _, Part in pairs(Parts) do
  2302. Part.Anchored = false
  2303. end
  2304. MainPart.Anchored = false
  2305. end
  2306. end
  2307.  
  2308. local function PerfectionWeld()
  2309. local Tool = GetNearestParent(script, "Tool")
  2310.  
  2311. local Parts = GetBricks(script.Parent)
  2312. 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]
  2313.  
  2314. if PrimaryPart then
  2315. WeldParts(Parts, PrimaryPart, "Weld", false)
  2316. else
  2317. warn("qWeld - Unable to weld part")
  2318. end
  2319.  
  2320. return Tool
  2321. end
  2322.  
  2323. local Tool = PerfectionWeld()
  2324.  
  2325.  
  2326. if Tool and script.ClassName == "Script" then
  2327. --- Don't bother with local scripts
  2328.  
  2329. script.Parent.AncestryChanged:connect(function()
  2330. PerfectionWeld()
  2331. end)
  2332. end
  2333.  
  2334. -- Created by Quenty (@Quenty, follow me on twitter).
  2335. end;
  2336. function() -- Created by Quenty (@Quenty, follow me on twitter).
  2337. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  2338. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  2339.  
  2340. --[[ INSTRUCTIONS
  2341. - Place in the model
  2342. - Make sure model is anchored
  2343. - That's it. It will weld the model and all children.
  2344.  
  2345. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2346. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2347. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2348. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2349. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2350. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2351. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2352. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  2353.  
  2354. 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.
  2355. ]]
  2356.  
  2357. --[[ DOCUMENTATION
  2358. - 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.
  2359. - Will work in PBS servers
  2360. - Will work as long as it starts out with the part anchored
  2361. - Stores the relative CFrame as a CFrame value
  2362. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  2363. - Utilizes a recursive algorith to find all parts in the model
  2364. - Will reweld on script reparent if the script is initially parented to a tool.
  2365. - Welds as fast as possible
  2366. ]]
  2367.  
  2368. -- qPerfectionWeld.lua
  2369. -- Created 10/6/2014
  2370. -- Author: Quenty
  2371. -- Version 1.0.3
  2372.  
  2373. -- Updated 10/14/2014 - Updated to 1.0.1
  2374. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  2375.  
  2376. -- Updated 10/14/2014 - Updated to 1.0.2
  2377. --- Fixed bug fix.
  2378.  
  2379. -- Updated 10/14/2014 - Updated to 1.0.3
  2380. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  2381.  
  2382. 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).
  2383.  
  2384.  
  2385. local function CallOnChildren(Instance, FunctionToCall)
  2386. -- Calls a function on each of the children of a certain object, using recursion.
  2387.  
  2388. FunctionToCall(Instance)
  2389.  
  2390. for _, Child in next, Instance:GetChildren() do
  2391. CallOnChildren(Child, FunctionToCall)
  2392. end
  2393. end
  2394.  
  2395. local function GetNearestParent(Instance, ClassName)
  2396. -- Returns the nearest parent of a certain class, or returns nil
  2397.  
  2398. local Ancestor = Instance
  2399. repeat
  2400. Ancestor = Ancestor.Parent
  2401. if Ancestor == nil then
  2402. return nil
  2403. end
  2404. until Ancestor:IsA(ClassName)
  2405.  
  2406. return Ancestor
  2407. end
  2408.  
  2409. local function GetBricks(StartInstance)
  2410. local List = {}
  2411.  
  2412. -- if StartInstance:IsA("BasePart") then
  2413. -- List[#List+1] = StartInstance
  2414. -- end
  2415.  
  2416. CallOnChildren(StartInstance, function(Item)
  2417. if Item:IsA("BasePart") then
  2418. List[#List+1] = Item;
  2419. end
  2420. end)
  2421.  
  2422. return List
  2423. end
  2424.  
  2425. local function Modify(Instance, Values)
  2426. -- Modifies an Instance by using a table.
  2427.  
  2428. assert(type(Values) == "table", "Values is not a table");
  2429.  
  2430. for Index, Value in next, Values do
  2431. if type(Index) == "number" then
  2432. Value.Parent = Instance
  2433. else
  2434. Instance[Index] = Value
  2435. end
  2436. end
  2437. return Instance
  2438. end
  2439.  
  2440. local function Make(ClassType, Properties)
  2441. -- Using a syntax hack to create a nice way to Make new items.
  2442.  
  2443. return Modify(Instance.new(ClassType), Properties)
  2444. end
  2445.  
  2446. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  2447. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  2448.  
  2449. local function HasWheelJoint(Part)
  2450. for _, SurfaceName in pairs(Surfaces) do
  2451. for _, HingSurfaceName in pairs(HingSurfaces) do
  2452. if Part[SurfaceName].Name == HingSurfaceName then
  2453. return true
  2454. end
  2455. end
  2456. end
  2457.  
  2458. return false
  2459. end
  2460.  
  2461. local function ShouldBreakJoints(Part)
  2462. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  2463. -- definitely some edge cases.
  2464.  
  2465. if NEVER_BREAK_JOINTS then
  2466. return false
  2467. end
  2468.  
  2469. if HasWheelJoint(Part) then
  2470. return false
  2471. end
  2472.  
  2473. local Connected = Part:GetConnectedParts()
  2474.  
  2475. if #Connected == 1 then
  2476. return false
  2477. end
  2478.  
  2479. for _, Item in pairs(Connected) do
  2480. if HasWheelJoint(Item) then
  2481. return false
  2482. elseif not Item:IsDescendantOf(script.Parent) then
  2483. return false
  2484. end
  2485. end
  2486.  
  2487. return true
  2488. end
  2489.  
  2490. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  2491. --- Weld's 2 parts together
  2492. -- @param Part0 The first part
  2493. -- @param Part1 The second part (Dependent part most of the time).
  2494. -- @param [JointType] The type of joint. Defaults to weld.
  2495. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  2496. -- @return The weld created.
  2497.  
  2498. JointType = JointType or "Weld"
  2499. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  2500.  
  2501. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  2502. Modify(NewWeld, {
  2503. Name = "qCFrameWeldThingy";
  2504. Part0 = Part0;
  2505. Part1 = Part1;
  2506. C0 = CFrame.new();--Part0.CFrame:inverse();
  2507. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  2508. Parent = Part1;
  2509. })
  2510.  
  2511. if not RelativeValue then
  2512. RelativeValue = Make("CFrameValue", {
  2513. Parent = Part1;
  2514. Name = "qRelativeCFrameWeldValue";
  2515. Archivable = true;
  2516. Value = NewWeld.C1;
  2517. })
  2518. end
  2519.  
  2520. return NewWeld
  2521. end
  2522.  
  2523. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  2524. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  2525. -- @param MainPart The part to weld the model to (can be in the model).
  2526. -- @param [JointType] The type of joint. Defaults to weld.
  2527. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  2528.  
  2529. for _, Part in pairs(Parts) do
  2530. if ShouldBreakJoints(Part) then
  2531. Part:BreakJoints()
  2532. end
  2533. end
  2534.  
  2535. for _, Part in pairs(Parts) do
  2536. if Part ~= MainPart then
  2537. WeldTogether(MainPart, Part, JointType, MainPart)
  2538. end
  2539. end
  2540.  
  2541. if not DoNotUnanchor then
  2542. for _, Part in pairs(Parts) do
  2543. Part.Anchored = false
  2544. end
  2545. MainPart.Anchored = false
  2546. end
  2547. end
  2548.  
  2549. local function PerfectionWeld()
  2550. local Tool = GetNearestParent(script, "Tool")
  2551.  
  2552. local Parts = GetBricks(script.Parent)
  2553. 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]
  2554.  
  2555. if PrimaryPart then
  2556. WeldParts(Parts, PrimaryPart, "Weld", false)
  2557. else
  2558. warn("qWeld - Unable to weld part")
  2559. end
  2560.  
  2561. return Tool
  2562. end
  2563.  
  2564. local Tool = PerfectionWeld()
  2565.  
  2566.  
  2567. if Tool and script.ClassName == "Script" then
  2568. --- Don't bother with local scripts
  2569.  
  2570. script.Parent.AncestryChanged:connect(function()
  2571. PerfectionWeld()
  2572. end)
  2573. end
  2574.  
  2575. -- Created by Quenty (@Quenty, follow me on twitter).
  2576. end;
  2577. function() ragdollS = true
  2578.  
  2579. -- Load config
  2580. config = script.Config
  2581.  
  2582. ahd = config.Auto_Head_Decap.Value
  2583. gore = config.Gore.Value
  2584. bod = config.Blood_On_Death.Value
  2585.  
  2586.  
  2587. Character = script.Parent
  2588. Humanoid = Character.Humanoid
  2589. Torso = Character.Torso
  2590.  
  2591. function OnDeath()
  2592. Humanoid.Parent = nil
  2593. if Torso then
  2594. Torso.Parent = game.Workspace
  2595. local Head = Character:FindFirstChild("Head")
  2596. if Head then
  2597. Head.Parent = game.Workspace
  2598. local Neck = Instance.new("Weld")
  2599. Neck.Name = "Neck"
  2600. Neck.Part0 = Torso
  2601. Neck.Part1 = Head
  2602. Neck.C0 = CFrame.new(0, 1.5, 0)
  2603. Neck.C1 = CFrame.new()
  2604. Neck.Parent = Torso
  2605.  
  2606. script.HDecap:Clone().Parent = Head
  2607.  
  2608. if ahd then
  2609. Head:BreakJoints()
  2610.  
  2611. if bod then
  2612. blood = game.Lighting.Blood:Clone()
  2613. blood.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
  2614. blood.Parent = game.Workspace
  2615.  
  2616. blood = game.Lighting.Blood:Clone()
  2617. blood.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
  2618. blood.Parent = game.Workspace
  2619.  
  2620. blood = game.Lighting.Blood:Clone()
  2621. blood.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
  2622. blood.Parent = game.Workspace
  2623. end
  2624.  
  2625. if gore then
  2626. brain = game.Lighting["Brain Gib"]:Clone()
  2627. brain.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
  2628. brain.Parent = game.Workspace
  2629.  
  2630. flesh = game.Lighting["Flesh Gib"]:Clone()
  2631. flesh.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
  2632. flesh.Parent = game.Workspace
  2633.  
  2634. flesh = game.Lighting["Flesh Gib"]:Clone()
  2635. flesh.CFrame = CFrame.new(Vector3.new(Head.Position.X+math.random(-5,5),Head.Position.Y+math.random(-5,5),Head.Position.Z+math.random(-5,5)))
  2636. flesh.Parent = game.Workspace
  2637. end
  2638. end
  2639. end
  2640. local Limb = Character:FindFirstChild("Right Arm")
  2641. if Limb then
  2642. Limb.Parent = game.Workspace
  2643. script.Decap:Clone().Parent = Limb
  2644. Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
  2645. local Joint = Instance.new("Glue")
  2646. Joint.Name = "RightShoulder"
  2647. Joint.Part0 = Torso
  2648. Joint.Part1 = Limb
  2649. Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2650. Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2651. Joint.Parent = Torso
  2652.  
  2653. local B = Instance.new("Part")
  2654. B.TopSurface = 0
  2655. B.BottomSurface = 0
  2656. B.formFactor = "Symmetric"
  2657. B.Size = Vector3.new(1, 1, 1)
  2658. B.Transparency = 1
  2659. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  2660. B.Parent = Character
  2661. local W = Instance.new("Weld")
  2662. W.Part0 = Limb
  2663. W.Part1 = B
  2664. W.C0 = CFrame.new(0, -0.5, 0)
  2665. W.Parent = Limb
  2666.  
  2667. end
  2668. local Limb = Character:FindFirstChild("Left Arm")
  2669. if Limb then
  2670. Limb.Parent = game.Workspace
  2671. script.Decap:Clone().Parent = Limb
  2672. Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
  2673. local Joint = Instance.new("Glue")
  2674. Joint.Name = "LeftShoulder"
  2675. Joint.Part0 = Torso
  2676. Joint.Part1 = Limb
  2677. Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2678. Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2679. Joint.Parent = Torso
  2680.  
  2681. local B = Instance.new("Part")
  2682. B.TopSurface = 0
  2683. B.BottomSurface = 0
  2684. B.formFactor = "Symmetric"
  2685. B.Size = Vector3.new(1, 1, 1)
  2686. B.Transparency = 1
  2687. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  2688. B.Parent = Character
  2689. local W = Instance.new("Weld")
  2690. W.Part0 = Limb
  2691. W.Part1 = B
  2692. W.C0 = CFrame.new(0, -0.5, 0)
  2693. W.Parent = Limb
  2694.  
  2695. end
  2696. local Limb = Character:FindFirstChild("Right Leg")
  2697. if Limb then
  2698. Limb.Parent = game.Workspace
  2699. script.Decap:Clone().Parent = Limb
  2700. Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
  2701. local Joint = Instance.new("Glue")
  2702. Joint.Name = "RightHip"
  2703. Joint.Part0 = Torso
  2704. Joint.Part1 = Limb
  2705. Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2706. Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  2707. Joint.Parent = Torso
  2708.  
  2709. local B = Instance.new("Part")
  2710. B.TopSurface = 0
  2711. B.BottomSurface = 0
  2712. B.formFactor = "Symmetric"
  2713. B.Size = Vector3.new(1, 1, 1)
  2714. B.Transparency = 1
  2715. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  2716. B.Parent = Character
  2717. local W = Instance.new("Weld")
  2718. W.Part0 = Limb
  2719. W.Part1 = B
  2720. W.C0 = CFrame.new(0, -0.5, 0)
  2721. W.Parent = Limb
  2722.  
  2723. end
  2724. local Limb = Character:FindFirstChild("Left Leg")
  2725. if Limb then
  2726. Limb.Parent = game.Workspace
  2727. script.Decap:Clone().Parent = Limb
  2728. Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
  2729. local Joint = Instance.new("Glue")
  2730. Joint.Name = "LeftHip"
  2731. Joint.Part0 = Torso
  2732. Joint.Part1 = Limb
  2733. Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2734. Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  2735. Joint.Parent = Torso
  2736.  
  2737. local B = Instance.new("Part")
  2738. B.TopSurface = 0
  2739. B.BottomSurface = 0
  2740. B.formFactor = "Symmetric"
  2741. B.Size = Vector3.new(1, 1, 1)
  2742. B.Transparency = 1
  2743. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  2744. B.Parent = Character
  2745. local W = Instance.new("Weld")
  2746. W.Part0 = Limb
  2747. W.Part1 = B
  2748. W.C0 = CFrame.new(0, -0.5, 0)
  2749. W.Parent = Limb
  2750.  
  2751. end
  2752. --[
  2753. local Bar = Instance.new("Part")
  2754. Bar.TopSurface = 0
  2755. Bar.BottomSurface = 0
  2756. Bar.formFactor = "Symmetric"
  2757. Bar.Size = Vector3.new(1, 1, 1)
  2758. Bar.Transparency = 1
  2759. Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
  2760. Bar.Parent = game.Workspace
  2761. local Weld = Instance.new("Weld")
  2762. Weld.Part0 = Torso
  2763. Weld.Part1 = Bar
  2764. Weld.C0 = CFrame.new(0, 0.5, 0)
  2765. Weld.Parent = Torso
  2766. --]]
  2767. end
  2768. end
  2769.  
  2770. Humanoid.Died:connect(OnDeath)
  2771. end;
  2772. function() function OnTouched(hit)
  2773. if script.Parent.Velocity.Magnitude >= 80 or hit.Velocity.Magnitude >= 80 then
  2774. script.Parent:BreakJoints()
  2775. flesh = game.Lighting["Flesh Gib"]:Clone()
  2776. flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
  2777. flesh.Parent = game.Workspace
  2778.  
  2779. flesh = game.Lighting["Flesh Gib"]:Clone()
  2780. flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
  2781. flesh.Parent = game.Workspace
  2782.  
  2783. script.Parent.BrickColor = BrickColor.new('Persimmon')
  2784.  
  2785. b = script.Blood:Clone()
  2786. f = script.fall:Clone()
  2787. g = script.Gorey:Clone()
  2788.  
  2789. b.Parent = script.Parent
  2790. f.Parent = script.Parent
  2791. g.Parent = script.Parent
  2792.  
  2793. b.blood.Disabled = false
  2794.  
  2795.  
  2796. script:Remove()
  2797. end
  2798. end
  2799.  
  2800. script.Parent.Touched:connect(OnTouched) end;
  2801. function() script.Parent.Enabled = true
  2802. wait(5)
  2803. script.Parent.Enabled = false
  2804. wait(1)
  2805. script.Parent.Enabled = true
  2806. wait(3)
  2807. script.Parent.Enabled = false
  2808. script.Disabled = true end;
  2809. function() function OnTouched(hit)
  2810. if script.Parent.Velocity.Magnitude >= 5 then
  2811. blood = game.Lighting.Blood:Clone()
  2812. blood.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),.1,script.Parent.Position.Z+math.random(-5,5)))
  2813. blood.Parent = game.Workspace
  2814. end
  2815.  
  2816. if script.Parent.Velocity.Magnitude >= 20 then
  2817. script.Parent.Blood.blood.Disabled = false
  2818. script.Parent.fall.Pitch = math.random(5,15)/10
  2819. script.Parent.fall:Play()
  2820. end
  2821. end
  2822.  
  2823. script.Parent.Touched:connect(OnTouched) end;
  2824. function() function OnTouched(hit)
  2825. if script.Parent.Velocity.Magnitude >= 80 or hit.Velocity.Magnitude >= 80 then
  2826. script.Parent:BreakJoints()
  2827. brain = game.Lighting["Brain Gib"]:Clone()
  2828. brain.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
  2829. brain.Parent = game.Workspace
  2830.  
  2831. flesh = game.Lighting["Flesh Gib"]:Clone()
  2832. flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
  2833. flesh.Parent = game.Workspace
  2834.  
  2835. flesh = game.Lighting["Flesh Gib"]:Clone()
  2836. flesh.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),script.Parent.Position.Y+math.random(-5,5),script.Parent.Position.Z+math.random(-5,5)))
  2837. flesh.Parent = game.Workspace
  2838.  
  2839. b = script.Blood:Clone()
  2840. f = script.fall:Clone()
  2841. g = script.Gorey:Clone()
  2842.  
  2843. b.Parent = script.Parent
  2844. f.Parent = script.Parent
  2845. g.Parent = script.Parent
  2846.  
  2847. b.blood.Disabled = false
  2848.  
  2849.  
  2850. script.Parent.BrickColor = BrickColor.new('Persimmon')
  2851.  
  2852. script:Remove()
  2853. end
  2854. end
  2855.  
  2856. script.Parent.Touched:connect(OnTouched) end;
  2857. function() script.Parent.Enabled = true
  2858. wait(5)
  2859. script.Parent.Enabled = false
  2860. wait(1)
  2861. script.Parent.Enabled = true
  2862. wait(3)
  2863. script.Parent.Enabled = false
  2864. script.Disabled = true end;
  2865. function() function OnTouched(hit)
  2866. if script.Parent.Velocity.Magnitude >= 5 then
  2867. blood = game.Lighting.Blood:Clone()
  2868. blood.CFrame = CFrame.new(Vector3.new(script.Parent.Position.X+math.random(-5,5),.1,script.Parent.Position.Z+math.random(-5,5)))
  2869. blood.Parent = game.Workspace
  2870. end
  2871.  
  2872. if script.Parent.Velocity.Magnitude >= 20 then
  2873. script.Parent.Blood.blood.Disabled = false
  2874. script.Parent.fall.Pitch = math.random(5,15)/10
  2875. script.Parent.fall:Play()
  2876. end
  2877. end
  2878.  
  2879. script.Parent.Touched:connect(OnTouched) end;
  2880. function() local CurrentPart = nil
  2881. local MaxInc = 16
  2882.  
  2883. function onTouched(hit)
  2884. if hit.Parent == nil then
  2885. return
  2886. end
  2887.  
  2888. local humanoid = hit.Parent:findFirstChild("Humanoid")
  2889.  
  2890. if humanoid == nil then
  2891. CurrentPart = hit
  2892. end
  2893. end
  2894.  
  2895. function waitForChild(parent, childName)
  2896. local child = parent:findFirstChild(childName)
  2897.  
  2898. if child then
  2899. return child
  2900. end
  2901.  
  2902. while true do
  2903. print(childName)
  2904.  
  2905. child = parent.ChildAdded:wait()
  2906.  
  2907. if child.Name==childName then
  2908. return child
  2909. end
  2910. end
  2911. end
  2912.  
  2913. local Figure = script.Parent
  2914. local Humanoid = waitForChild(Figure, "Humanoid")
  2915. local Torso = waitForChild(Figure, "Torso")
  2916. local Left = waitForChild(Figure, "Left Leg")
  2917. local Right = waitForChild(Figure, "Right Leg")
  2918.  
  2919. Humanoid.Jump = true
  2920.  
  2921. Left.Touched:connect(onTouched)
  2922. Right.Touched:connect(onTouched)
  2923.  
  2924. while true do
  2925. wait(math.random(2, 10))
  2926.  
  2927. if CurrentPart ~= nil then
  2928. if math.random(1, 2) == 1 then
  2929. Humanoid.Jump = true
  2930. end
  2931.  
  2932. Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
  2933. end
  2934. end end;
  2935. function() ---This server script creates the sounds and also exists so that it can be easily copied into an NPC and create sounds for that NPC.
  2936. --Remove the local script if you copy this into an NPC.
  2937. function waitForChild(parent, childName)
  2938. local child = parent:findFirstChild(childName)
  2939. if child then return child end
  2940. while true do
  2941. child = parent.ChildAdded:wait()
  2942. if child.Name==childName then return child end
  2943. end
  2944. end
  2945. function newSound(name, id)
  2946. local sound = Instance.new("Sound")
  2947. sound.SoundId = id
  2948. sound.Name = name
  2949. sound.archivable = false
  2950. sound.Parent = script.Parent.Head
  2951. return sound
  2952. end
  2953. -- declarations
  2954. local sGettingUp = newSound("GettingUp", "rbxasset://sounds/action_get_up.mp3")
  2955. local sDied = newSound("Died", "rbxasset://sounds/uuhhh.mp3")
  2956. local sFreeFalling = newSound("FreeFalling", "rbxasset://sounds/action_falling.mp3")
  2957. local sJumping = newSound("Jumping", "rbxasset://sounds/action_jump.mp3")
  2958. local sLanding = newSound("Landing", "rbxasset://sounds/action_jump_land.mp3")
  2959. local sSplash = newSound("Splash", "rbxasset://sounds/impact_water.mp3")
  2960. local sRunning = newSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3")
  2961. sRunning.Looped = true
  2962. local sSwimming = newSound("Swimming", "rbxasset://sounds/action_swim.mp3")
  2963. sSwimming.Looped = true
  2964. local sClimbing = newSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3")
  2965. sClimbing.Looped = true
  2966.  
  2967. local Figure = script.Parent
  2968. local Head = waitForChild(Figure, "Head")
  2969. local Humanoid;
  2970. for _,Child in pairs(Figure:GetChildren())do
  2971. if Child and Child.ClassName=="Humanoid"then
  2972. Humanoid=Child;
  2973. end;
  2974. end;
  2975. local hasPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
  2976. local filteringEnabled = game.Workspace.FilteringEnabled
  2977.  
  2978. local prevState = "None"
  2979.  
  2980. -- functions
  2981.  
  2982. function onDied()
  2983. stopLoopedSounds()
  2984. for _,Child in pairs(Figure:FindFirstChild("Head"):GetChildren())do
  2985. if Child and Child.ClassName=="Sound"then
  2986. Child.Volume=0
  2987. Child:Stop()
  2988. end
  2989. end
  2990. sDied.Volume=1;
  2991. sDied:Play();
  2992. end
  2993.  
  2994. local fallCount = 0
  2995. local fallSpeed = 0
  2996. function onStateFall(state, sound)
  2997. fallCount = fallCount + 1
  2998. if state then
  2999. sound.Volume = 0
  3000. sound:Play()
  3001. Spawn( function()
  3002. local t = 0
  3003. local thisFall = fallCount
  3004. while t < 1.5 and fallCount == thisFall do
  3005. local vol = math.max(t - 0.3 , 0)
  3006. sound.Volume = vol
  3007. wait(0.1)
  3008. t = t + 0.1
  3009. end
  3010. end)
  3011. else
  3012. sound:Stop()
  3013. end
  3014. fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
  3015. end
  3016.  
  3017.  
  3018. function onStateNoStop(state, sound)
  3019. if state then
  3020. sound:Play()
  3021. end
  3022. end
  3023.  
  3024.  
  3025. function onRunning(speed)
  3026. sClimbing:Stop()
  3027. sSwimming:Stop()
  3028. if (prevState == "FreeFall" and fallSpeed > 0.1) then
  3029. local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
  3030. sLanding.Volume = vol
  3031. sLanding:Play()
  3032. fallSpeed = 0
  3033. end
  3034. if speed>0.5 then
  3035. sRunning:Play()
  3036. sRunning.Pitch = speed / 8.0
  3037. else
  3038. sRunning:Stop()
  3039. end
  3040. prevState = "Run"
  3041. end
  3042.  
  3043. function onSwimming(speed)
  3044. if (prevState ~= "Swim" and speed > 0.1) then
  3045. local volume = math.min(1.0, speed / 350)
  3046. sSplash.Volume = volume
  3047. sSplash:Play()
  3048. prevState = "Swim"
  3049. end
  3050. sClimbing:Stop()
  3051. sRunning:Stop()
  3052. sSwimming.Pitch = 1.6
  3053. sSwimming:Play()
  3054. end
  3055.  
  3056. function onClimbing(speed)
  3057. sRunning:Stop()
  3058. sSwimming:Stop()
  3059. if speed>0.01 then
  3060. sClimbing:Play()
  3061. sClimbing.Pitch = speed / 5.5
  3062. else
  3063. sClimbing:Stop()
  3064. end
  3065. prevState = "Climb"
  3066. end
  3067. -- connect up
  3068.  
  3069. function stopLoopedSounds()
  3070. sRunning:Stop()
  3071. sClimbing:Stop()
  3072. sSwimming:Stop()
  3073. end
  3074.  
  3075. if hasPlayer == nil then
  3076. Humanoid.Died:connect(onDied)
  3077. Humanoid.Running:connect(onRunning)
  3078. Humanoid.Swimming:connect(onSwimming)
  3079. Humanoid.Climbing:connect(onClimbing)
  3080. Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
  3081. Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
  3082. Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
  3083. Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
  3084. Humanoid.StateChanged:connect(function(old, new)
  3085. if not (new.Name == "Dead" or
  3086. new.Name == "Running" or
  3087. new.Name == "RunningNoPhysics" or
  3088. new.Name == "Swimming" or
  3089. new.Name == "Jumping" or
  3090. new.Name == "GettingUp" or
  3091. new.Name == "Freefall" or
  3092. new.Name == "FallingDown") then
  3093. stopLoopedSounds()
  3094. end
  3095. end)
  3096. end
  3097. end;
  3098. function() --This local script will run only for the player whos character it is in. It's changes to the sounds will replicate as they are changes to the character.
  3099. -- util
  3100.  
  3101. function waitForChild(parent, childName)
  3102. local child = parent:findFirstChild(childName)
  3103. if child then return child end
  3104. while true do
  3105. child = parent.ChildAdded:wait()
  3106. if child.Name==childName then return child end
  3107. end
  3108. end
  3109.  
  3110.  
  3111. -- declarations
  3112.  
  3113. local Figure = script.Parent.Parent
  3114. local Head = waitForChild(Figure, "Head")
  3115. local Humanoid = waitForChild(Figure, "Humanoid")
  3116.  
  3117. local sGettingUp = waitForChild(Head, "GettingUp")
  3118. local sDied = waitForChild(Head, "Died")
  3119. local sFreeFalling = waitForChild(Head, "FreeFalling")
  3120. local sJumping = waitForChild(Head, "Jumping")
  3121. local sLanding = waitForChild(Head, "Landing")
  3122. local sSplash = waitForChild(Head, "Splash")
  3123. local sRunning = waitForChild(Head, "Running")
  3124. sRunning.Looped = true
  3125. local sSwimming = waitForChild(Head, "Swimming")
  3126. sSwimming.Looped = true
  3127. local sClimbing =waitForChild(Head, "Climbing")
  3128. sClimbing.Looped = true
  3129.  
  3130. local prevState = "None"
  3131.  
  3132. -- functions
  3133.  
  3134. function onDied()
  3135. stopLoopedSounds()
  3136. sDied:Play()
  3137. end
  3138.  
  3139. local fallCount = 0
  3140. local fallSpeed = 0
  3141. function onStateFall(state, sound)
  3142. fallCount = fallCount + 1
  3143. if state then
  3144. sound.Volume = 0
  3145. sound:Play()
  3146. Spawn( function()
  3147. local t = 0
  3148. local thisFall = fallCount
  3149. while t < 1.5 and fallCount == thisFall do
  3150. local vol = math.max(t - 0.3 , 0)
  3151. sound.Volume = vol
  3152. wait(0.1)
  3153. t = t + 0.1
  3154. end
  3155. end)
  3156. else
  3157. sound:Stop()
  3158. end
  3159. fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
  3160. end
  3161.  
  3162.  
  3163. function onStateNoStop(state, sound)
  3164. if state then
  3165. sound:Play()
  3166. end
  3167. end
  3168.  
  3169.  
  3170. function onRunning(speed)
  3171. sClimbing:Stop()
  3172. sSwimming:Stop()
  3173. if (prevState == "FreeFall" and fallSpeed > 0.1) then
  3174. local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
  3175. sLanding.Volume = vol
  3176. sLanding:Play()
  3177. fallSpeed = 0
  3178. end
  3179. if speed>0.5 then
  3180. sRunning:Play()
  3181. sRunning.Pitch = speed / 8.0
  3182. else
  3183. sRunning:Stop()
  3184. end
  3185. prevState = "Run"
  3186. end
  3187.  
  3188. function onSwimming(speed)
  3189. if (prevState ~= "Swim" and speed > 0.1) then
  3190. local volume = math.min(1.0, speed / 350)
  3191. sSplash.Volume = volume
  3192. sSplash:Play()
  3193. prevState = "Swim"
  3194. end
  3195. sClimbing:Stop()
  3196. sRunning:Stop()
  3197. sSwimming.Pitch = 1.6
  3198. sSwimming:Play()
  3199. end
  3200.  
  3201. function onClimbing(speed)
  3202. sRunning:Stop()
  3203. sSwimming:Stop()
  3204. if speed>0.01 then
  3205. sClimbing:Play()
  3206. sClimbing.Pitch = speed / 5.5
  3207. else
  3208. sClimbing:Stop()
  3209. end
  3210. prevState = "Climb"
  3211. end
  3212. -- connect up
  3213.  
  3214. function stopLoopedSounds()
  3215. sRunning:Stop()
  3216. sClimbing:Stop()
  3217. sSwimming:Stop()
  3218. end
  3219.  
  3220. Humanoid.Died:connect(onDied)
  3221. Humanoid.Running:connect(onRunning)
  3222. Humanoid.Swimming:connect(onSwimming)
  3223. Humanoid.Climbing:connect(onClimbing)
  3224. Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
  3225. Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
  3226. Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
  3227. Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
  3228. Humanoid.StateChanged:connect(function(old, new)
  3229. if not (new.Name == "Dead" or
  3230. new.Name == "Running" or
  3231. new.Name == "RunningNoPhysics" or
  3232. new.Name == "Swimming" or
  3233. new.Name == "Jumping" or
  3234. new.Name == "GettingUp" or
  3235. new.Name == "Freefall" or
  3236. new.Name == "FallingDown") then
  3237. stopLoopedSounds()
  3238. end
  3239. end)
  3240.  
  3241. end;}local ActualScripts = {}
  3242. function s(var)
  3243. local func = table.remove(Scripts,1)
  3244. setfenv(func,setmetatable({script=var,require=fake_require or require,global=genv},{
  3245. __index = getfenv(func),
  3246. }))
  3247. table.insert(ActualScripts,coroutine.wrap(func))
  3248. end
  3249. Decode = function(str,t,props,classes,values,ICList,Model,CurPar,LastIns,split,RemoveAndSplit,InstanceList)
  3250. local tonum,table_remove,inst,parnt,comma,table_foreach = tonumber,table.remove,Instance.new,"Parent",",",
  3251. function(t,f)
  3252. for a,b in pairs(t) do
  3253. f(a,b)
  3254. end
  3255. end
  3256. local Types = {
  3257. Color3 = Color3.new,
  3258. Vector3 = Vector3.new,
  3259. Vector2 = Vector2.new,
  3260. UDim = UDim.new,
  3261. UDim2 = UDim2.new,
  3262. CFrame = CFrame.new,
  3263. Rect = Rect.new,
  3264. NumberRange = NumberRange.new,
  3265. BrickColor = BrickColor.new,
  3266. PhysicalProperties = PhysicalProperties.new,
  3267. NumberSequence = function(...)
  3268. local a = {...}
  3269. local t = {}
  3270. repeat
  3271. t[#t+1] = NumberSequenceKeypoint.new(table_remove(a,1),table_remove(a,1),table_remove(a,1))
  3272. until #a==0
  3273. return NumberSequence.new(t)
  3274. end,
  3275. ColorSequence = function(...)
  3276. local a = {...}
  3277. local t = {}
  3278. repeat
  3279. t[#t+1] = ColorSequenceKeypoint.new(table_remove(a,1),Color3.new(table_remove(a,1),table_remove(a,1),table_remove(a,1)))
  3280. until #a==0
  3281. return ColorSequence.new(t)
  3282. end,
  3283. number = tonumber,
  3284. boolean = function(a)
  3285. return a=="1"
  3286. end
  3287. }
  3288. split = function(str,sep)
  3289. if not str then return end
  3290. local fields = {}
  3291. local ConcatNext = false
  3292. str:gsub(("([^%s]+)"):format(sep),function(c)
  3293. if ConcatNext == true then
  3294. fields[#fields] = fields[#fields]..sep..c
  3295. ConcatNext = false
  3296. else
  3297. fields[#fields+1] = c
  3298. end
  3299. if c:sub(#c)=="\\" then
  3300. c = fields[#fields]
  3301. fields[#fields] = c:sub(1,#c-1)
  3302. ConcatNext = true
  3303. end
  3304. end)
  3305. return fields
  3306. end
  3307. RemoveAndSplit = function(t)
  3308. return split(table_remove(t,1),comma)
  3309. end
  3310. t = split(str,";")
  3311. props = RemoveAndSplit(t)
  3312. classes = RemoveAndSplit(t)
  3313. values = split(table_remove(t,1),'|')
  3314. ICList = RemoveAndSplit(t)
  3315. InstanceList = {}
  3316. Model = inst"Model"
  3317. CurPar = Model
  3318. table_foreach(t,function(ct,c)
  3319. if c=="n" or c=="p" then
  3320. CurPar = c=="n" and LastIns or CurPar[parnt]
  3321. else
  3322. ct = split(c,"|")
  3323. local class = classes[tonum(table_remove(ct,1))]
  3324. if class=="UnionOperation" then
  3325. LastIns = {UsePartColor="1"}
  3326. else
  3327. LastIns = inst(class)
  3328. if LastIns:IsA"Script" then
  3329. s(LastIns)
  3330. elseif LastIns:IsA("ModuleScript") then
  3331. ms(LastIns)
  3332. end
  3333. end
  3334.  
  3335. local function SetProperty(LastIns,p,str,s)
  3336. s = Types[typeof(LastIns[p])]
  3337. if p=="CustomPhysicalProperties" then
  3338. s = PhysicalProperties.new
  3339. end
  3340. if s then
  3341. LastIns[p] = s(unpack(split(str,comma)))
  3342. else
  3343. LastIns[p] = str
  3344. end
  3345. end
  3346.  
  3347. local UnionData
  3348. table_foreach(ct,function(s,p,a,str)
  3349. a = p:find":"
  3350. p,str = props[tonum(p:sub(1,a-1))],values[tonum(p:sub(a+1))]
  3351. if p=="UnionData" then
  3352. UnionData = split(str," ")
  3353. return
  3354. end
  3355. if class=="UnionOperation" then
  3356. LastIns[p] = str
  3357. return
  3358. end
  3359. SetProperty(LastIns,p,str)
  3360. end)
  3361.  
  3362. if UnionData then
  3363. local LI_Data = LastIns
  3364. LastIns = DecodeUnion(UnionData)
  3365. table_foreach(LI_Data,function(p,str)
  3366. SetProperty(LastIns,p,str)
  3367. end)
  3368. end
  3369. table.insert(InstanceList,LastIns)
  3370. LastIns[parnt] = CurPar
  3371. end
  3372. end)
  3373. table_remove(ICList,1)
  3374. table_foreach(ICList,function(a,b)
  3375. b = split(b,">")
  3376. InstanceList[tonum(b[1])][props[tonum(b[2])]] = InstanceList[tonum(b[3])]
  3377. end)
  3378.  
  3379. return Model:GetChildren()
  3380. end
  3381.  
  3382. local Objects = Decode('Name,HeadColor3,LeftArmColor3,RightArmColor3,LeftLegColor3,RightLegColor3,TorsoColor3,AnimationId,Value,MeshId,BodyPart,NameOcclusion,Health,MaxHealth,JumpPower,Color,Transparency,Position,Orientation'
  3383. ..',Size,TopSurface,CFrame,Scale,MeshType,Anchored,Material,BottomSurface,Texture,MaxVelocity,C0,C1,Part0,Part1,CanCollide,Velocity,LeftSurface,RightSurface,Enabled,Speed,Acceleration,Lifetime,EmitterSiz'
  3384. ..'e,SoundId,Volume,PantsTemplate,ShirtTemplate;Part,Model,BodyColors,Script,StringValue,Animation,NumberValue,CharacterMesh,Humanoid,LocalScript,Attachment,SpecialMesh,Decal,Motor6D,MeshPart,Folder,Bool'
  3385. ..'Value,ParticleEmitter,Sound,Pants,Shirt;Part|NPC|0.898,0.8941,0.8745|0.4549,0.5254,0.6156|Animate|climb|ClimbAnim|http://www.roblox.com/asset/?id=180436334|fall|FallAnim|http://www.roblox.com/asset/?i'
  3386. ..'d=180436148|idle|Animation1|http://www.roblox.com/asset/?id=180435571|Weight|9|Animation2|http://www.roblox.com/asset/?id=180435792|1|jump|JumpAnim|http://www.roblox.com/asset/?id=125750702|run|RunAni'
  3387. ..'m|http://www.roblox.com/asset/?id=180426354|sit|SitAnim|http://www.roblox.com/asset/?id=178130996|toolnone|ToolNoneAnim|http://www.roblox.com/asset/?id=182393478|walk|WalkAnim|BloodS|3.0 Male Right Ar'
  3388. ..'m|82908019|3|1|1000|0|Status|AvalibleSpawns|Respawn|3.0 Male Left Arm|82907977|2|3.0 Male Right Leg|81487710|5|Head|-23.7335,7.803,54.5893|0,90,0|3.468,1.734,1.734|0|HairAttachment|0,1.0404,0|0,1.0404'
  3389. ..',0,1,0,0,0,1,0,0,0,1|HatAttachment|FaceFrontAttachment|0,0,-1.0405|0,0,-1.0405,1,0,0,0,1,0,0,0,1|FaceCenterAttachment|2.1675,2.1675,2.1675|http://www.roblox.com/asset/?id=83001675|Ball|0.0509,0.4117,0'
  3390. ..'.6745|272|-24.3067,7.0602,53.8004|0.8175,0.7815,0.887|-23.5875,7.2208,55.548|1.6038,1.5199,1.7117|-23.5875,7.5397,53.9094|0.7695,1.4408,0.8846|-23.5875,7.2232,53.4959|-23.5419,7.4582,54.5903|1.6949,2.'
  3391. ..'2007,1.0836|-23.5875,7.5397,55.1489|-24.3067,7.0602,55.3275|BloxMan|0.9372,0.7215,0.2196|-23.9705,8.2927,54.5696|-13.9,90,0|2.0225,1.0112,1.0112|1.264,1.264,1.264|http://roblox.com/asset/?id=83001675|'
  3392. ..'http://www.roblox.com/asset/?id=102312301|qPerfectionWeld|HumanoidRootPart|-23.7335,5.202,54.5893|3.468,3.468,1.734|RootJoint|0.1|0,0,0,-1,0,0,0,0,1,0,1,-0|Left Arm|-23.7335,5.202,57.1903|1.734,3.468,'
  3393. ..'1.734|LeftShoulderAttachment|0,0.867,0|0,0.867,0,1,0,0,0,1,0,0,0,1|LeftArm|LeftHand|-24.2951,3.3811,57.5148|0,90,28.6|1.0311,1.6387,1.1069|-24.1367,5.1729,57.4395|20.6499,84.41,-15.95|0.9358,0.9675,0.'
  3394. ..'7278|-24.0997,4.0795,57.8457|-0.0001,-0.0001,-0.0001|0.9358,0.9675,0.9675|LeftLowerArm|-23.6393,4.8733,57.5879|1.291,1.7125,1.2868|LeftUpperArm|-23.5934,6.1268,56.9409|0,90.1699,-28.3|1.5223,2.2981,1.'
  3395. ..'5487|-23.657,5.8553,57.1776|-31.3,0,0|1.6733,2.0233,1.1531|-23.5875,6.9727,56.8582|2.2726,1.7261,1.7884|Left Leg|-23.7335,1.734,55.4563|LeftFoot|0.6431,0.7411,0.2784|-23.7934,0.3705,55.3776|0,90.1699,'
  3396. ..'0|0.9437,0.7411,1.734|LeftLowerLeg|-23.635,1.2015,55.4025|0.9741,2.125,1.1876|LeftUpperLeg|-23.6504,2.6936,55.4251|1.1991,2.5506,1.3511|-23.2866,1.8232,55.3552|0.6922,1.7009,1.0617|-23.9027,1.8232,55.'
  3397. ..'3552|-24.1329,3.0818,55.4394|0.7982,1.9612,1.2242|-23.5671,3.1776,55.419|1.4575,1.6783,1.0755|Right Arm|-23.7335,5.202,51.9883|RightShoulderAttachment|RightArm|RightHand|-24.0278,5.2356,51.8409|20.649'
  3398. ..'9,84.41,12.25|-23.9678,3.989,51.4478|0,-0.0001,-0.0001|-24.1249,3.3907,51.7017|0,90,-18.8|RightLowerArm|-23.5543,4.7993,51.7324|RightUpperArm|-23.6046,6.1719,52.2737|0,90.1699,13.3|-23.651,5.8688,52.0'
  3399. ..'416|14.6999,0,0|1.6613,2.0233,1.1962|-23.5875,6.9727,52.4063|Right Leg|-23.7335,1.734,53.7223|Legs|RightFoot|-23.7978,0.3705,53.8926|RightLowerLeg|-23.6395,1.2015,53.8667|RightUpperLeg|-23.6551,2.6936'
  3400. ..',53.8443|-24.1329,3.0818,53.7732|-23.9027,1.8232,53.9101|-23.4904,3.1248,53.8299|1.4575,1.7838,1.169|-23.2866,1.8232,53.9101|Torso|roblox|NeckAttachment|0,1.734,0|0,1.734,0,1,0,0,0,1,0,0,0,1|BodyBackA'
  3401. ..'ttachment|0,0,0.867|0,0,0.867,1,0,0,0,1,0,0,0,1|LeftCollarAttachment|-1.7341,1.734,0|-1.7341,1.734,0,1,0,0,0,1,0,0,0,1|RightCollarAttachment|1.734,1.734,0|1.734,1.734,0,1,0,0,0,1,0,0,0,1|WaistFrontAtt'
  3402. ..'achment|0,-1.7341,-0.8671|0,-1.7341,-0.8671,1,0,0,0,1,0,0,0,1|WaistCenterAttachment|0,-1.7341,0|0,-1.7341,0,1,0,0,0,1,0,0,0,1|WaistBackAttachment|0,-1.7341,0.867|0,-1.7341,0.867,1,0,0,0,1,0,0,0,1|Body'
  3403. ..'FrontAttachment|0,0,-0.8671|0,0,-0.8671,1,0,0,0,1,0,0,0,1|Right Shoulder|1.734,0.867,0,0,0,1,0,1,-0,-1,0,0|-0.8671,0.867,0,0,0,1,0,1,-0,-1,0,0|Left Shoulder|-1.7341,0.867,0,0,0,-1,0,1,0,1,0,0|0.867,0.'
  3404. ..'867,0,0,0,-1,0,1,0,1,0,0|Right Hip|1.734,-1.7341,0,0,0,1,0,1,-0,-1,0,0|0.867,1.734,0,0,0,1,0,1,-0,-1,0,0|Left Hip|-1.7341,-1.7341,0,0,0,-1,0,1,0,1,0,0|-0.8671,1.734,0,0,0,-1,0,1,0,1,0,0|Neck|0,1.734,0'
  3405. ..',-1,0,0,0,0,1,0,1,-0|0,-0.8671,0,-1,0,0,0,0,1,0,1,-0|LowerTorso|-23.7595,4.2125,54.635|2.8026,1.1978,1.8205|UpperTorso|-23.763,5.5976,54.635|3.6154,3.2592,2.135|Pillow|-24.5951,5.3517,55.0589|0,-90,90'
  3406. ..'|0.6809,1.0214,0.3404|0.3404,0.5107,0.3404|http://www.roblox.com/asset/?id=19106014|-24.5768,5.3517,54.2535|0,-90,-90|-24.6225,4.9537,54.9859|0.5737,0.8605,0.2868|0.2868,0.4302,0.2868|-24.607,4.9537,5'
  3407. ..'4.3074|-24.5884,6.2643,55.3515|1.2146,1.8219,0.6073|0.863,0.9109,0.6072|-24.6205,4.6157,54.8798|0.4307,0.646,0.2153|0.2153,0.323,0.2153|-24.6089,4.6157,54.3703|-24.5884,6.2643,53.9107|-24.375,4.2896,5'
  3408. ..'4.6227|0.7383,1.0764,1.5343|-23.868,3.5252,54.6754|1.1195,1.0764,1.1507|Blood And Gore|Config|Auto_Head_Decap|Gore|Blood_On_Death|Decap|Blood|0,1,0,0,1,0.2784,0,0|0,0.5,0,1,0.5,0|10,10|0,-10,2|2,2|blo'
  3409. ..'od|Gorey|rbxassetid://178646271|0.3|HDecap|3.0 Male Left Leg|81487640|4|Move|Pants|http://www.roblox.com/asset/?id=144076759|Shirt|http://www.roblox.com/asset/?id=144076357|Sound|LocalSound|3.0 Male T'
  3410. ..'orso|82907945;0,77>32>76,77>33>132,142>32>132,142>33>105,143>32>132,143>33>78,144>32>132,144>33>118,145>32>132,145>33>91,146>32>132,146>33>51;2|1:2;n;3|2:3|3:3|4:3|5:4|6:4|7:3;4|1:5;n;5|1:6;n;6|1:7|8:'
  3411. ..'8;p;5|1:9;n;6|1:10|8:11;p;5|1:12;n;6|1:13|8:14;n;7|1:15|9:16;p;6|1:17|8:18;n;7|1:15|9:19;p;p;5|1:20;n;6|1:21|8:22;p;5|1:23;n;6|1:24|8:25;p;5|1:26;n;6|1:27|8:28;p;5|1:29;n;6|1:30|8:31;p;5|1:32;n;6|1:33'
  3412. ..'|8:25;p;p;4|1:34;8|1:35|10:36|11:37;9|12:38|13:39|14:39|15:40;n;2|1:41;n;2|1:42;p;p;4|1:43;8|1:44|10:45|11:46;10|1:5;n;5|1:12;n;6|1:13|8:14;n;7|1:15|9:16;p;6|1:17|8:18;n;7|1:15|9:19;p;p;5|1:32;n;6|1:3'
  3413. ..'3|8:25;p;5|1:23;n;6|1:24|8:25;p;5|1:20;n;6|1:21|8:22;p;5|1:6;n;6|1:7|8:8;p;5|1:29;n;6|1:30|8:31;p;5|1:9;n;6|1:10|8:11;p;5|1:26;n;6|1:27|8:28;p;p;8|1:47|10:48|11:49;1|1:50|16:3|17:19|18:51|19:52|20:53|'
  3414. ..'21:54|16:3|16:3;n;11|1:55|18:56|22:57;11|1:58|18:56|22:57;11|1:59|18:60|22:61;11|1:62;12|23:63|10:64|24:49;2|1:50;n;1|1:65|25:19|16:66|26:67|18:68|20:69|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:'
  3415. ..'19|16:66|26:67|18:70|20:71|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:72|20:73|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:74|20:71|27:54|21:54|16:66|16:66;n'
  3416. ..';12|24:37;p;1|1:65|25:19|16:66|26:67|18:75|20:76|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:77|20:73|27:54|21:54|16:66|16:66;n;12|24:37;p;1|1:65|25:19|16:66|26:67|18:78|20:69|27:'
  3417. ..'54|21:54|16:66|16:66;n;12|24:37;p;1|1:79|25:19|16:80|18:81|19:82|20:83|21:54|16:80|16:80;n;12|23:84|10:85|24:49;13|28:86;p;p;4|1:87;p;1|1:88|17:19|18:89|19:52|20:90|27:54|21:54;n;14|1:91|29:92|30:93|3'
  3418. ..'1:93;p;1|1:94|16:3|17:19|18:95|19:52|20:96|34:40|16:3|16:3;n;11|1:97|18:98|22:99;2|1:100;n;15|1:101|25:19|16:80|18:102|19:103|20:104|34:40|16:80|16:80;15|1:101|25:19|16:80|18:105|19:106|20:107|34:40|1'
  3419. ..'6:80|16:80;15|1:101|25:19|16:80|18:108|19:106|35:109|20:110|34:40|16:80|16:80;15|1:111|25:19|16:80|18:112|19:106|35:109|20:113|34:40|16:80|16:80;15|1:114|25:19|16:80|18:115|19:116|35:109|20:117|34:40|'
  3420. ..'16:80|16:80;1|1:65|25:19|16:80|26:67|18:118|19:119|20:120|27:54|21:54|16:80|16:80;n;12|24:37;p;1|1:65|25:19|16:80|26:67|18:121|20:122|27:54|21:54|16:80|16:80;n;12|24:37;p;p;4|1:87;p;1|1:123|16:4|17:19'
  3421. ..'|18:124|19:52|20:96|34:40|27:54|16:4|16:4;n;2;n;15|1:125|25:19|16:126|18:127|19:128|35:109|20:129|34:40|16:126|16:126;15|1:130|25:19|16:126|18:131|19:128|35:109|20:132|34:40|16:126|16:126;15|1:133|25:'
  3422. ..'19|16:126|18:134|19:128|35:109|20:135|34:40|16:126|16:126;1|1:65|25:19|16:126|26:67|18:136|20:137|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:138|20:137|27:54|21:54|16:126|16:1'
  3423. ..'26;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:139|20:140|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:141|20:142|27:54|21:54|16:126|16:126;n;12|24:37;p;p;4|1:87;p;1|1:143|16:3|17'
  3424. ..':19|18:144|19:52|20:96|34:40|16:3|16:3;n;11|1:145|18:98|22:99;2|1:146;n;15|1:147|25:19|16:80|18:148|19:149|20:110|34:40|16:80|16:80;15|1:147|25:19|16:80|18:150|19:149|35:151|20:110|34:40|16:80|16:80;1'
  3425. ..'5|1:147|25:19|16:80|18:152|19:153|20:104|34:40|16:80|16:80;15|1:154|25:19|16:80|18:155|19:149|35:151|20:113|34:40|16:80|16:80;15|1:156|25:19|16:80|18:157|19:158|35:151|20:117|34:40|16:80|16:80;1|1:65|'
  3426. ..'25:19|16:80|26:67|18:159|19:160|20:161|27:54|21:54|16:80|16:80;n;12|24:37;p;1|1:65|25:19|16:80|26:67|18:162|20:122|27:54|21:54|16:80|16:80;n;12|24:37;p;p;4|1:87;p;1|1:163|16:4|17:19|18:164|19:52|20:96'
  3427. ..'|34:40|27:54|16:4|16:4;n;2|1:165;n;15|1:166|25:19|16:126|18:167|19:128|35:109|20:129|34:40|16:126|16:126;15|1:168|25:19|16:126|18:169|19:128|35:109|20:132|34:40|16:126|16:126;15|1:170|25:19|16:126|18:'
  3428. ..'171|19:128|20:135|34:40|16:126|16:126;1|1:65|25:19|16:126|26:67|18:172|20:140|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:173|20:137|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:'
  3429. ..'65|25:19|16:126|26:67|18:174|20:175|27:54|21:54|16:126|16:126;n;12|24:37;p;1|1:65|25:19|16:126|26:67|18:176|20:137|27:54|21:54|16:126|16:126;n;12|24:37;p;p;4|1:87;p;1|1:177|16:3|17:19|18:89|19:52|20:9'
  3430. ..'0|36:46|37:46|16:3|16:3;n;13|1:178;11|1:179|18:180|22:181;11|1:182|18:183|22:184;11|1:185|18:186|22:187;11|1:188|18:189|22:190;11|1:191|18:192|22:193;11|1:194|18:195|22:196;11|1:197|18:198|22:199;11|1'
  3431. ..':200|18:201|22:202;14|1:203|29:92|30:204|31:205;14|1:206|29:92|30:207|31:208;14|1:209|29:92|30:210|31:211;14|1:212|29:92|30:213|31:214;14|1:215|29:92|30:216|31:217;2|1:177;n;15|1:218|25:19|16:66|18:21'
  3432. ..'9|19:128|35:109|20:220|16:66|16:66;15|1:221|25:19|16:66|18:222|19:128|35:109|20:223|16:66|16:66;1|1:224|25:19|16:66|18:225|19:226|20:227|27:54|21:54|16:66|16:66;n;12|23:228|10:229|24:49;p;1|1:224|25:1'
  3433. ..'9|16:66|18:230|19:231|20:227|27:54|21:54|16:66|16:66;n;12|23:228|10:229|24:49;p;1|1:224|25:19|16:66|18:232|19:226|20:233|27:54|21:54|16:66|16:66;n;12|23:234|10:229|24:49;p;1|1:224|25:19|16:66|18:235|1'
  3434. ..'9:231|20:233|27:54|21:54|16:66|16:66;n;12|23:234|10:229|24:49;p;1|1:224|25:19|16:66|18:236|19:226|20:237|27:54|21:54|16:66|16:66;n;12|23:238|10:229|24:49;p;1|1:224|25:19|16:66|18:239|19:226|20:240|27:'
  3435. ..'54|21:54|16:66|16:66;n;12|23:241|10:229|24:49;p;1|1:224|25:19|16:66|18:242|19:231|20:240|27:54|21:54|16:66|16:66;n;12|23:241|10:229|24:49;p;1|1:224|25:19|16:66|18:243|19:231|20:237|27:54|21:54|16:66|1'
  3436. ..'6:66;n;12|23:238|10:229|24:49;p;1|1:65|25:19|16:66|26:67|18:244|20:245|27:54|21:54|16:66|16:66;n;12|24:37;p;p;1|1:65|25:19|16:126|26:67|18:246|20:247|27:54|21:54|16:126|16:126;n;12|24:37;p;4|1:87;p;4|'
  3437. ..'1:248;n;16|1:249;n;17|1:250;17|1:251|9:19;17|1:252|9:19;p;4|1:253;n;18|1:254|16:255|20:256|38:40|16:255|39:257|40:258|16:255|41:259;n;4|1:260;p;4|1:261;19|1:9|42:40|43:262|44:263;p;4|1:264;n;18|1:254|'
  3438. ..'16:255|20:256|38:40|16:255|39:257|40:258|16:255|41:259;n;4|1:260;p;4|1:261;19|1:9|42:40|43:262|44:263;p;p;8|1:265|10:266|11:267;4|1:268;20|1:269|45:270;21|1:271|46:272;4|1:273;n;10|1:274;p;8|1:275|10:'
  3439. ..'276|11:38;p;')
  3440. for _,Object in pairs(Objects) do
  3441. Object.Parent = script and script.Parent==workspace and script or workspace
  3442. end
  3443. for _,f in pairs(ActualScripts) do f() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement