A_GUES

Player Chat Controller Script

Mar 9th, 2023
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.48 KB | None | 0 0
  1. --made by rouxhaver/1+1=2
  2. --chat "/e chat " to move your head to someone, then when you chat it looks like they chatted (;
  3.  
  4. --only works well in games without player collison, no chat gui and bubble chat (Like Rate My Avatar)
  5.  
  6. --recommended Head:
  7. --https://www.roblox.com/bundles/337/City-Life-Woman
  8.  
  9.  
  10.  
  11. --reanimate by MyWorld#4430 discord.gg/pYVHtSJmEY
  12. local v3_net, v3_808 = Vector3.new(0.1, 25.1, 0.1), Vector3.new(8, 0, 8)
  13. local function getNetlessVelocity(realPartVelocity)
  14. if realPartVelocity.Magnitude > 1 then
  15. local unit = realPartVelocity.Unit
  16. if (unit.Y > 0.25) or (unit.Y < -0.75) then
  17. return unit * (25.1 / unit.Y)
  18. end
  19. end
  20. return v3_net + realPartVelocity * v3_808
  21. end
  22. local simradius = "shp" --simulation radius (net bypass) method
  23. --"shp" - sethiddenproperty
  24. --"ssr" - setsimulationradius
  25. --false - disable
  26. local simrad = math.huge --simulation radius value
  27. local healthHide = false --moves your head away every 3 seconds so players dont see your health bar (alignmode 4 only)
  28. local reclaim = true --if you lost control over a part this will move your primary part to the part so you get it back (alignmode 4)
  29. local novoid = true --prevents parts from going under workspace.FallenPartsDestroyHeight if you control them (alignmode 4 only)
  30. local physp = nil --PhysicalProperties.new(0.01, 0, 1, 0, 0) --sets .CustomPhysicalProperties to this for each part
  31. local noclipAllParts = false --set it to true if you want noclip
  32. local antiragdoll = true --removes hingeConstraints and ballSocketConstraints from your character
  33. local newanimate = true --disables the animate script and enables after reanimation
  34. local discharscripts = true --disables all localScripts parented to your character before reanimation
  35. local R15toR6 = true --tries to convert your character to r6 if its r15
  36. local hatcollide = true --makes hats cancollide (credit to ShownApe) (works only with reanimate method 0)
  37. local humState16 = true --enables collisions for limbs before the humanoid dies (using hum:ChangeState)
  38. local addtools = false --puts all tools from backpack to character and lets you hold them after reanimation
  39. local hedafterneck = true --disable aligns for head and enable after neck or torso is removed
  40. local loadtime = game:GetService("Players").RespawnTime + 0.5 --anti respawn delay
  41. local method = 3 --reanimation method
  42. --methods:
  43. --0 - breakJoints (takes [loadtime] seconds to load)
  44. --1 - limbs
  45. --2 - limbs + anti respawn
  46. --3 - limbs + breakJoints after [loadtime] seconds
  47. --4 - remove humanoid + breakJoints
  48. --5 - remove humanoid + limbs
  49. local alignmode = 1 --AlignPosition mode
  50. --modes:
  51. --1 - AlignPosition rigidity enabled true
  52. --2 - 2 AlignPositions rigidity enabled both true and false
  53. --3 - AlignPosition rigidity enabled false
  54. --4 - no AlignPosition, CFrame only
  55. local flingpart = "HumanoidRootPart" --name of the part or the hat used for flinging
  56. --the fling function
  57. --usage: fling(target, duration, velocity)
  58. --target can be set to: basePart, CFrame, Vector3, character model or humanoid (flings at mouse.Hit if argument not provided)
  59. --duration (fling time in seconds) can be set to a number or a string convertable to a number (0.5s if not provided)
  60. --velocity (fling part rotation velocity) can be set to a vector3 value (Vector3.new(20000, 20000, 20000) if not provided)
  61.  
  62. local lp = game:GetService("Players").LocalPlayer
  63. local rs, ws, sg = game:GetService("RunService"), game:GetService("Workspace"), game:GetService("StarterGui")
  64. local stepped, heartbeat, renderstepped = rs.Stepped, rs.Heartbeat, rs.RenderStepped
  65. local twait, tdelay, rad, inf, abs, clamp = task.wait, task.delay, math.rad, math.huge, math.abs, math.clamp
  66. local cf, v3, angles = CFrame.new, Vector3.new, CFrame.Angles
  67. local v3_0, cf_0 = v3(0, 0, 0), cf(0, 0, 0)
  68.  
  69. local c = lp.Character
  70. if not (c and c.Parent) then
  71. return
  72. end
  73.  
  74. c:GetPropertyChangedSignal("Parent"):Connect(function()
  75. if not (c and c.Parent) then
  76. c = nil
  77. end
  78. end)
  79.  
  80. local clone, destroy, getchildren, getdescendants, isa = c.Clone, c.Destroy, c.GetChildren, c.GetDescendants, c.IsA
  81.  
  82. local function gp(parent, name, className)
  83. if typeof(parent) == "Instance" then
  84. for i, v in pairs(getchildren(parent)) do
  85. if (v.Name == name) and isa(v, className) then
  86. return v
  87. end
  88. end
  89. end
  90. return nil
  91. end
  92.  
  93. local fenv = getfenv()
  94.  
  95. local shp = fenv.sethiddenproperty or fenv.set_hidden_property or fenv.set_hidden_prop or fenv.sethiddenprop
  96. local ssr = fenv.setsimulationradius or fenv.set_simulation_radius or fenv.set_sim_radius or fenv.setsimradius or fenv.setsimrad or fenv.set_sim_rad
  97.  
  98. healthHide = healthHide and ((method == 0) or (method == 2) or (method == 3)) and gp(c, "Head", "BasePart")
  99.  
  100. local reclaim, lostpart = reclaim and c.PrimaryPart, nil
  101.  
  102. local function align(Part0, Part1)
  103.  
  104. local att0 = Instance.new("Attachment")
  105. att0.Position, att0.Orientation, att0.Name = v3_0, v3_0, "att0_" .. Part0.Name
  106. local att1 = Instance.new("Attachment")
  107. att1.Position, att1.Orientation, att1.Name = v3_0, v3_0, "att1_" .. Part1.Name
  108.  
  109. if alignmode == 4 then
  110.  
  111. local hide = false
  112. if Part0 == healthHide then
  113. healthHide = false
  114. tdelay(0, function()
  115. while twait(2.9) and Part0 and c do
  116. hide = #Part0:GetConnectedParts() == 1
  117. twait(0.1)
  118. hide = false
  119. end
  120. end)
  121. end
  122.  
  123. local rot = rad(0.05)
  124. local con0, con1 = nil, nil
  125. con0 = stepped:Connect(function()
  126. if not (Part0 and Part1) then return con0:Disconnect() and con1:Disconnect() end
  127. Part0.RotVelocity = Part1.RotVelocity
  128. end)
  129. local lastpos = Part0.Position
  130. con1 = heartbeat:Connect(function(delta)
  131. if not (Part0 and Part1 and att1) then return con0:Disconnect() and con1:Disconnect() end
  132. if (not Part0.Anchored) and (Part0.ReceiveAge == 0) then
  133. if lostpart == Part0 then
  134. lostpart = nil
  135. end
  136. local newcf = Part1.CFrame * att1.CFrame
  137. if Part1.Velocity.Magnitude > 0.1 then
  138. Part0.Velocity = getNetlessVelocity(Part1.Velocity)
  139. else
  140. local vel = (newcf.Position - lastpos) / delta
  141. Part0.Velocity = getNetlessVelocity(vel)
  142. if vel.Magnitude < 1 xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed> 0.01 then
  143. Part0.Velocity = getNetlessVelocity(Part1.Velocity)
  144. else
  145. Part0.Velocity = getNetlessVelocity((Part0.Position - lastpos) / delta)
  146. end
  147. lastpos = Part0.Position
  148. end)
  149.  
  150. end
  151.  
  152. att0:GetPropertyChangedSignal("Parent"):Connect(function()
  153. Part0 = att0.Parent
  154. if not isa(Part0, "BasePart") then
  155. att0 = nil
  156. if lostpart == Part0 then
  157. lostpart = nil
  158. end
  159. Part0 = nil
  160. end
  161. end)
  162. att0.Parent = Part0
  163.  
  164. att1:GetPropertyChangedSignal("Parent"):Connect(function()
  165. Part1 = att1.Parent
  166. if not isa(Part1, "BasePart") then
  167. att1 = nil
  168. Part1 = nil
  169. end
  170. end)
  171. att1.Parent = Part1
  172. end
  173.  
  174. local function respawnrequest()
  175. local ccfr, c = ws.CurrentCamera.CFrame, lp.Character
  176. lp.Character = nil
  177. lp.Character = c
  178. local con = nil
  179. con = ws.CurrentCamera.Changed:Connect(function(prop)
  180. if (prop ~= "Parent") and (prop ~= "CFrame") then
  181. return
  182. end
  183. ws.CurrentCamera.CFrame = ccfr
  184. con:Disconnect()
  185. end)
  186. end
  187.  
  188. local destroyhum = (method == 4) or (method == 5)
  189. local breakjoints = (method == 0) or (method == 4)
  190. local antirespawn = (method == 0) or (method == 2) or (method == 3)
  191.  
  192. hatcollide = hatcollide and (method == 0)
  193.  
  194. addtools = addtools and lp:FindFirstChildOfClass("Backpack")
  195.  
  196. if type(simrad) ~= "number" then simrad = 1000 end
  197. if shp and (simradius == "shp") then
  198. tdelay(0, function()
  199. while c do
  200. shp(lp, "SimulationRadius", simrad)
  201. heartbeat:Wait()
  202. end
  203. end)
  204. elseif ssr and (simradius == "ssr") then
  205. tdelay(0, function()
  206. while c do
  207. ssr(simrad)
  208. heartbeat:Wait()
  209. end
  210. end)
  211. end
  212.  
  213. if antiragdoll then
  214. antiragdoll = function(v)
  215. if isa(v, "HingeConstraint") or isa(v, "BallSocketConstraint") then
  216. v.Parent = nil
  217. end
  218. end
  219. for i, v in pairs(getdescendants(c)) do
  220. antiragdoll(v)
  221. end
  222. c.DescendantAdded:Connect(antiragdoll)
  223. end
  224.  
  225. if antirespawn then
  226. respawnrequest()
  227. end
  228.  
  229. if method == 0 then
  230. twait(loadtime)
  231. if not c then
  232. return
  233. end
  234. end
  235.  
  236. if discharscripts then
  237. for i, v in pairs(getdescendants(c)) do
  238. if isa(v, "LocalScript") then
  239. v.Disabled = true
  240. end
  241. end
  242. elseif newanimate then
  243. local animate = gp(c, "Animate", "LocalScript")
  244. if animate and (not animate.Disabled) then
  245. animate.Disabled = true
  246. else
  247. newanimate = false
  248. end
  249. end
  250.  
  251. if addtools then
  252. for i, v in pairs(getchildren(addtools)) do
  253. if isa(v, "Tool") then
  254. v.Parent = c
  255. end
  256. end
  257. end
  258.  
  259. pcall(function()
  260. settings().Physics.AllowSleep = false
  261. settings().Physics.PhysicsEnvironmentalThrottle = Enum.EnviromentalPhysicsThrottle.Disabled
  262. end)
  263.  
  264. local OLDscripts = {}
  265.  
  266. for i, v in pairs(getdescendants(c)) do
  267. if v.ClassName == "Script" then
  268. OLDscripts[v.Name] = true
  269. end
  270. end
  271.  
  272. local scriptNames = {}
  273.  
  274. for i, v in pairs(getdescendants(c)) do
  275. if isa(v, "BasePart") then
  276. local newName, exists = tostring(i), true
  277. while exists do
  278. exists = OLDscripts[newName]
  279. if exists then
  280. newName = newName .. "_"
  281. end
  282. end
  283. table.insert(scriptNames, newName)
  284. Instance.new("Script", v).Name = newName
  285. end
  286. end
  287.  
  288. local hum = c:FindFirstChildOfClass("Humanoid")
  289. if hum then
  290. for i, v in pairs(hum:GetPlayingAnimationTracks()) do
  291. v:Stop()
  292. end
  293. end
  294. c.Archivable = true
  295. local cl = clone(c)
  296. if hum and humState16 then
  297. hum:ChangeState(Enum.HumanoidStateType.Physics)
  298. if destroyhum then
  299. twait(1.6)
  300. end
  301. end
  302. if destroyhum then
  303. pcall(destroy, hum)
  304. end
  305.  
  306. if not c then
  307. return
  308. end
  309.  
  310. local head, torso, root = gp(c, "Head", "BasePart"), gp(c, "Torso", "BasePart") or gp(c, "UpperTorso", "BasePart"), gp(c, "HumanoidRootPart", "BasePart")
  311. if hatcollide then
  312. pcall(destroy, torso)
  313. pcall(destroy, root)
  314. pcall(destroy, c:FindFirstChildOfClass("BodyColors") or gp(c, "Health", "Script"))
  315. end
  316.  
  317. local model = Instance.new("Model", c)
  318. model:GetPropertyChangedSignal("Parent"):Connect(function()
  319. if not (model and model.Parent) then
  320. model = nil
  321. end
  322. end)
  323.  
  324. for i, v in pairs(getchildren(c)) do
  325. if v ~= model then
  326. if addtools and isa(v, "Tool") then
  327. for i1, v1 in pairs(getdescendants(v)) do
  328. if v1 and v1.Parent and isa(v1, "BasePart") then
  329. local bv = Instance.new("BodyVelocity")
  330. bv.Velocity, bv.MaxForce, bv.P, bv.Name = v3_0, v3(1000, 1000, 1000), 1250, "bv_" .. v.Name
  331. bv.Parent = v1
  332. end
  333. end
  334. end
  335. v.Parent = model
  336. end
  337. end
  338.  
  339. if breakjoints then
  340. model:BreakJoints()
  341. else
  342. if head and torso then
  343. for i, v in pairs(getdescendants(model)) do
  344. if isa(v, "JointInstance") then
  345. local save = false
  346. if (v.Part0 == torso) and (v.Part1 == head) then
  347. save = true
  348. end
  349. if (v.Part0 == head) and (v.Part1 == torso) then
  350. save = true
  351. end
  352. if save then
  353. if hedafterneck then
  354. hedafterneck = v
  355. end
  356. else
  357. pcall(destroy, v)
  358. end
  359. end
  360. end
  361. end
  362. if method == 3 then
  363. task.delay(loadtime, pcall, model.BreakJoints, model)
  364. end
  365. end
  366.  
  367. cl.Parent = ws
  368. for i, v in pairs(getchildren(cl)) do
  369. v.Parent = c
  370. end
  371. pcall(destroy, cl)
  372.  
  373. local uncollide, noclipcon = nil, nil
  374. if noclipAllParts then
  375. uncollide = function()
  376. if c then
  377. for i, v in pairs(getdescendants(c)) do
  378. if isa(v, "BasePart") then
  379. v.CanCollide = false
  380. end
  381. end
  382. else
  383. noclipcon:Disconnect()
  384. end
  385. end
  386. else
  387. uncollide = function()
  388. if model then
  389. for i, v in pairs(getdescendants(model)) do
  390. if isa(v, "BasePart") then
  391. v.CanCollide = false
  392. end
  393. end
  394. else
  395. noclipcon:Disconnect()
  396. end
  397. end
  398. end
  399. noclipcon = stepped:Connect(uncollide)
  400. uncollide()
  401.  
  402. for i, scr in pairs(getdescendants(model)) do
  403. if (scr.ClassName == "Script") and table.find(scriptNames, scr.Name) then
  404. local Part0 = scr.Parent
  405. if isa(Part0, "BasePart") then
  406. for i1, scr1 in pairs(getdescendants(c)) do
  407. if (scr1.ClassName == "Script") and (scr1.Name == scr.Name) and (not scr1:IsDescendantOf(model)) then
  408. local Part1 = scr1.Parent
  409. if (Part1.ClassName == Part0.ClassName) and (Part1.Name == Part0.Name) then
  410. align(Part0, Part1)
  411. pcall(destroy, scr)
  412. pcall(destroy, scr1)
  413. break
  414. end
  415. end
  416. end
  417. end
  418. end
  419. end
  420.  
  421. for i, v in pairs(getdescendants(c)) do
  422. if v and v.Parent and (not v:IsDescendantOf(model)) then
  423. if isa(v, "Decal") then
  424. v.Transparency = 1
  425. elseif isa(v, "BasePart") then
  426. v.Transparency = 1
  427. v.Anchored = false
  428. elseif isa(v, "ForceField") then
  429. v.Visible = false
  430. elseif isa(v, "Sound") then
  431. v.Playing = false
  432. elseif isa(v, "BillboardGui") or isa(v, "SurfaceGui") or isa(v, "ParticleEmitter") or isa(v, "Fire") or isa(v, "Smoke") or isa(v, "Sparkles") then
  433. v.Enabled = false
  434. end
  435. end
  436. end
  437.  
  438. if newanimate then
  439. local animate = gp(c, "Animate", "LocalScript")
  440. if animate then
  441. animate.Disabled = false
  442. end
  443. end
  444.  
  445. if addtools then
  446. for i, v in pairs(getchildren(c)) do
  447. if isa(v, "Tool") then
  448. v.Parent = addtools
  449. end
  450. end
  451. end
  452.  
  453. local hum0, hum1 = model:FindFirstChildOfClass("Humanoid"), c:FindFirstChildOfClass("Humanoid")
  454. if hum0 then
  455. hum0:GetPropertyChangedSignal("Parent"):Connect(function()
  456. if not (hum0 and hum0.Parent) then
  457. hum0 = nil
  458. end
  459. end)
  460. end
  461. if hum1 then
  462. hum1:GetPropertyChangedSignal("Parent"):Connect(function()
  463. if not (hum1 and hum1.Parent) then
  464. hum1 = nil
  465. end
  466. end)
  467.  
  468. ws.CurrentCamera.CameraSubject = hum1
  469. local camSubCon = nil
  470. local function camSubFunc()
  471. camSubCon:Disconnect()
  472. if c and hum1 then
  473. ws.CurrentCamera.CameraSubject = hum1
  474. end
  475. end
  476. camSubCon = renderstepped:Connect(camSubFunc)
  477. if hum0 then
  478. hum0:GetPropertyChangedSignal("Jump"):Connect(function()
  479. if hum1 then
  480. hum1.Jump = hum0.Jump
  481. end
  482. end)
  483. else
  484. respawnrequest()
  485. end
  486. end
  487.  
  488. local rb = Instance.new("BindableEvent", c)
  489. rb.Event:Connect(function()
  490. pcall(destroy, rb)
  491. sg:SetCore("ResetButtonCallback", true)
  492. if destroyhum then
  493. if c then c:BreakJoints() end
  494. return
  495. end
  496. if model and hum0 and (hum0.Health > 0) then
  497. model:BreakJoints()
  498. hum0.Health = 0
  499. end
  500. if antirespawn then
  501. respawnrequest()
  502. end
  503. end)
  504. sg:SetCore("ResetButtonCallback", rb)
  505.  
  506. tdelay(0, function()
  507. while c do
  508. if hum0 and hum1 then
  509. hum1.Jump = hum0.Jump
  510. end
  511. wait()
  512. end
  513. sg:SetCore("ResetButtonCallback", true)
  514. end)
  515.  
  516. R15toR6 = R15toR6 and hum1 and (hum1.RigType == Enum.HumanoidRigType.R15)
  517. if R15toR6 then
  518. local part = gp(c, "HumanoidRootPart", "BasePart") or gp(c, "UpperTorso", "BasePart") or gp(c, "LowerTorso", "BasePart") or gp(c, "Head", "BasePart") or c:FindFirstChildWhichIsA("BasePart")
  519. if part then
  520. local cfr = part.CFrame
  521. local R6parts = {
  522. head = {
  523. Name = "Head",
  524. Size = v3(2, 1, 1),
  525. R15 = {
  526. Head = 0
  527. }
  528. },
  529. torso = {
  530. Name = "Torso",
  531. Size = v3(2, 2, 1),
  532. R15 = {
  533. UpperTorso = 0.2,
  534. LowerTorso = -0.8
  535. }
  536. },
  537. root = {
  538. Name = "HumanoidRootPart",
  539. Size = v3(2, 2, 1),
  540. R15 = {
  541. HumanoidRootPart = 0
  542. }
  543. },
  544. leftArm = {
  545. Name = "Left Arm",
  546. Size = v3(1, 2, 1),
  547. R15 = {
  548. LeftHand = -0.849,
  549. LeftLowerArm = -0.174,
  550. LeftUpperArm = 0.415
  551. }
  552. },
  553. rightArm = {
  554. Name = "Right Arm",
  555. Size = v3(1, 2, 1),
  556. R15 = {
  557. RightHand = -0.849,
  558. RightLowerArm = -0.174,
  559. RightUpperArm = 0.415
  560. }
  561. },
  562. leftLeg = {
  563. Name = "Left Leg",
  564. Size = v3(1, 2, 1),
  565. R15 = {
  566. LeftFoot = -0.85,
  567. LeftLowerLeg = -0.29,
  568. LeftUpperLeg = 0.49
  569. }
  570. },
  571. rightLeg = {
  572. Name = "Right Leg",
  573. Size = v3(1, 2, 1),
  574. R15 = {
  575. RightFoot = -0.85,
  576. RightLowerLeg = -0.29,
  577. RightUpperLeg = 0.49
  578. }
  579. }
  580. }
  581. for i, v in pairs(getchildren(c)) do
  582. if isa(v, "BasePart") then
  583. for i1, v1 in pairs(getchildren(v)) do
  584. if isa(v1, "Motor6D") then
  585. v1.Part0 = nil
  586. end
  587. end
  588. end
  589. end
  590. part.Archivable = true
  591. for i, v in pairs(R6parts) do
  592. local part = clone(part)
  593. part:ClearAllChildren()
  594. part.Name, part.Size, part.CFrame, part.Anchored, part.Transparency, part.CanCollide = v.Name, v.Size, cfr, false, 1, false
  595. for i1, v1 in pairs(v.R15) do
  596. local R15part = gp(c, i1, "BasePart")
  597. local att = gp(R15part, "att1_" .. i1, "Attachment")
  598. if R15part then
  599. local weld = Instance.new("Weld")
  600. weld.Part0, weld.Part1, weld.C0, weld.C1, weld.Name = part, R15part, cf(0, v1, 0), cf_0, "Weld_" .. i1
  601. weld.Parent = R15part
  602. R15part.Massless, R15part.Name = true, "R15_" .. i1
  603. R15part.Parent = part
  604. if att then
  605. att.Position = v3(0, v1, 0)
  606. att.Parent = part
  607. end
  608. end
  609. end
  610. part.Parent = c
  611. R6parts[i] = part
  612. end
  613. local R6joints = {
  614. neck = {
  615. Parent = R6parts.torso,
  616. Name = "Neck",
  617. Part0 = R6parts.torso,
  618. Part1 = R6parts.head,
  619. C0 = cf(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),
  620. C1 = cf(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  621. },
  622. rootJoint = {
  623. Parent = R6parts.root,
  624. Name = "RootJoint" ,
  625. Part0 = R6parts.root,
  626. Part1 = R6parts.torso,
  627. C0 = cf(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),
  628. C1 = cf(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  629. },
  630. rightShoulder = {
  631. Parent = R6parts.torso,
  632. Name = "Right Shoulder",
  633. Part0 = R6parts.torso,
  634. Part1 = R6parts.rightArm,
  635. C0 = cf(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
  636. C1 = cf(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  637. },
  638. leftShoulder = {
  639. Parent = R6parts.torso,
  640. Name = "Left Shoulder",
  641. Part0 = R6parts.torso,
  642. Part1 = R6parts.leftArm,
  643. C0 = cf(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
  644. C1 = cf(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  645. },
  646. rightHip = {
  647. Parent = R6parts.torso,
  648. Name = "Right Hip",
  649. Part0 = R6parts.torso,
  650. Part1 = R6parts.rightLeg,
  651. C0 = cf(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
  652. C1 = cf(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  653. },
  654. leftHip = {
  655. Parent = R6parts.torso,
  656. Name = "Left Hip" ,
  657. Part0 = R6parts.torso,
  658. Part1 = R6parts.leftLeg,
  659. C0 = cf(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
  660. C1 = cf(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  661. }
  662. }
  663. for i, v in pairs(R6joints) do
  664. local joint = Instance.new("Motor6D")
  665. for prop, val in pairs(v) do
  666. joint[prop] = val
  667. end
  668. R6joints[i] = joint
  669. end
  670. if hum1 then
  671. hum1.RigType, hum1.HipHeight = Enum.HumanoidRigType.R6, 0
  672. end
  673. end
  674. --the default roblox animate script edited and put in one line
  675. local script = gp(c, "Animate", "LocalScript") if not script.Disabled then script:ClearAllChildren() local Torso = gp(c, "Torso", "BasePart") local RightShoulder = gp(Torso, "Right Shoulder", "Motor6D") local LeftShoulder = gp(Torso, "Left Shoulder", "Motor6D") local RightHip = gp(Torso, "Right Hip", "Motor6D") local LeftHip = gp(Torso, "Left Hip", "Motor6D") local Neck = gp(Torso, "Neck", "Motor6D") local Humanoid = c:FindFirstChildOfClass("Humanoid") local pose = "Standing" local currentAnim = "" local currentAnimInstance = nil local currentAnimTrack = nil local currentAnimKeyframeHandler = nil local currentAnimSpeed = 1.0 local animTable = {} local animNames = { idle = { { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 }, { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 } }, walk = { { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 } }, run = { { id = "run.xml", weight = 10 } }, jump = { { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } }, fall = { { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 } }, climb = { { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 } }, sit = { { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 } }, toolnone = { { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 } }, toolslash = { { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } }, toollunge = { { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } }, wave = { { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } }, point = { { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } }, dance1 = { { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 } }, dance2 = { { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 } }, dance3 = { { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 } }, laugh = { { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } }, cheer = { { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } }, } local dances = {"dance1", "dance2", "dance3"} local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false} local function configureAnimationSet(name, fileList) if (animTable[name] ~= nil) then for _, connection in pairs(animTable[name].connections) do connection:disconnect() end end animTable[name] = {} animTable[name].count = 0 animTable[name].totalWeight = 0 animTable[name].connections = {} local config = script:FindFirstChild(name) if (config ~= nil) then table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) local idx = 1 for _, childPart in pairs(config:GetChildren()) do if (childPart:IsA("Animation")) then table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) animTable[name][idx] = {} animTable[name][idx].anim = childPart local weightObject = childPart:FindFirstChild("Weight") if (weightObject == nil) then animTable[name][idx].weight = 1 else animTable[name][idx].weight = weightObject.Value end animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight idx = idx + 1 end end end if (animTable[name].count <= 0) then for idx, anim in pairs(fileList) do animTable[name][idx] = {} animTable[name][idx].anim = Instance.new("Animation") animTable[name][idx].anim.Name = name animTable[name][idx].anim.AnimationId = anim.id animTable[name][idx].weight = anim.weight animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + anim.weight end end end local function scriptChildModified(child) local fileList = animNames[child.Name] if (fileList ~= nil) then configureAnimationSet(child.Name, fileList) end end script.ChildAdded:connect(scriptChildModified) script.ChildRemoved:connect(scriptChildModified) local animator = Humanoid and Humanoid:FindFirstChildOfClass("Animator") or nil if animator then local animTracks = animator:GetPlayingAnimationTracks() for i, track in ipairs(animTracks) do track:Stop(0) track:Destroy() end end for name, fileList in pairs(animNames) do configureAnimationSet(name, fileList) end local toolAnim = "None" local toolAnimTime = 0 local jumpAnimTime = 0 local jumpAnimDuration = 0.3 local toolTransitionTime = 0.1 local fallTransitionTime = 0.3 local jumpMaxLimbVelocity = 0.75 local function stopAllAnimations() local oldAnim = currentAnim if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then oldAnim = "idle" end currentAnim = "" currentAnimInstance = nil if (currentAnimKeyframeHandler ~= nil) then currentAnimKeyframeHandler:disconnect() end if (currentAnimTrack ~= nil) then currentAnimTrack:Stop() currentAnimTrack:Destroy() currentAnimTrack = nil end return oldAnim end local function playAnimation(animName, transitionTime, humanoid) local roll = math.random(1, animTable[animName].totalWeight) local origRoll = roll local idx = 1 while (roll > animTable[animName][idx].weight) do roll = roll - animTable[animName][idx].weight idx = idx + 1 end local anim = animTable[animName][idx].anim if (anim ~= currentAnimInstance) then if (currentAnimTrack ~= nil) then currentAnimTrack:Stop(transitionTime) currentAnimTrack:Destroy() end currentAnimSpeed = 1.0 currentAnimTrack = humanoid:LoadAnimation(anim) currentAnimTrack.Priority = Enum.AnimationPriority.Core currentAnimTrack:Play(transitionTime) currentAnim = animName currentAnimInstance = anim if (currentAnimKeyframeHandler ~= nil) then currentAnimKeyframeHandler:disconnect() end currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc) end end local function setAnimationSpeed(speed) if speed ~= currentAnimSpeed then currentAnimSpeed = speed currentAnimTrack:AdjustSpeed(currentAnimSpeed) end end local function keyFrameReachedFunc(frameName) if (frameName == "End") then local repeatAnim = currentAnim if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then repeatAnim = "idle" end local animSpeed = currentAnimSpeed playAnimation(repeatAnim, 0.0, Humanoid) setAnimationSpeed(animSpeed) end end local toolAnimName = "" local toolAnimTrack = nil local toolAnimInstance = nil local currentToolAnimKeyframeHandler = nil local function toolKeyFrameReachedFunc(frameName) if (frameName == "End") then playToolAnimation(toolAnimName, 0.0, Humanoid) end end local function playToolAnimation(animName, transitionTime, humanoid, priority) local roll = math.random(1, animTable[animName].totalWeight) local origRoll = roll local idx = 1 while (roll > animTable[animName][idx].weight) do roll = roll - animTable[animName][idx].weight idx = idx + 1 end local anim = animTable[animName][idx].anim if (toolAnimInstance ~= anim) then if (toolAnimTrack ~= nil) then toolAnimTrack:Stop() toolAnimTrack:Destroy() transitionTime = 0 end toolAnimTrack = humanoid:LoadAnimation(anim) if priority then toolAnimTrack.Priority = priority end toolAnimTrack:Play(transitionTime) toolAnimName = animName toolAnimInstance = anim currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc) end end local function stopToolAnimations() local oldAnim = toolAnimName if (currentToolAnimKeyframeHandler ~= nil) then currentToolAnimKeyframeHandler:disconnect() end toolAnimName = "" toolAnimInstance = nil if (toolAnimTrack ~= nil) then toolAnimTrack:Stop() toolAnimTrack:Destroy() toolAnimTrack = nil end return oldAnim end local function onRunning(speed) if speed > 0.01 then playAnimation("walk", 0.1, Humanoid) if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then setAnimationSpeed(speed / 14.5) end pose = "Running" else if emoteNames[currentAnim] == nil then playAnimation("idle", 0.1, Humanoid) pose = "Standing" end end end local function onDied() pose = "Dead" end local function onJumping() playAnimation("jump", 0.1, Humanoid) jumpAnimTime = jumpAnimDuration pose = "Jumping" end local function onClimbing(speed) playAnimation("climb", 0.1, Humanoid) setAnimationSpeed(speed / 12.0) pose = "Climbing" end local function onGettingUp() pose = "GettingUp" end local function onFreeFall() if (jumpAnimTime <= 0) then playAnimation("fall", fallTransitionTime, Humanoid) end pose = "FreeFall" end local function onFallingDown() pose = "FallingDown" end local function onSeated() pose = "Seated" end local function onPlatformStanding() pose = "PlatformStanding" end local function onSwimming(speed) if speed > 0 then pose = "Running" else pose = "Standing" end end local function getTool() return c and c:FindFirstChildOfClass("Tool") end local function getToolAnim(tool) for _, c in ipairs(tool:GetChildren()) do if c.Name == "toolanim" and c.className == "StringValue" then return c end end return nil end local function animateTool() if (toolAnim == "None") then playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle) return end if (toolAnim == "Slash") then playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action) return end if (toolAnim == "Lunge") then playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action) return end end local function moveSit() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder:SetDesiredAngle(3.14 /2) LeftShoulder:SetDesiredAngle(-3.14 /2) RightHip:SetDesiredAngle(3.14 /2) LeftHip:SetDesiredAngle(-3.14 /2) end local lastTick = 0 local function move(time) local amplitude = 1 local frequency = 1 local deltaTime = time - lastTick lastTick = time local climbFudge = 0 local setAngles = false if (jumpAnimTime > 0) then jumpAnimTime = jumpAnimTime - deltaTime end if (pose == "FreeFall" and jumpAnimTime <= 0) then playAnimation("fall", fallTransitionTime, Humanoid) elseif (pose == "Seated") then playAnimation("sit", 0.5, Humanoid) return elseif (pose == "Running") then playAnimation("walk", 0.1, Humanoid) elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then stopAllAnimations() amplitude = 0.1 frequency = 1 setAngles = true end if (setAngles) then local desiredAngle = amplitude * math.sin(time * frequency) RightShoulder:SetDesiredAngle(desiredAngle + climbFudge) LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge) RightHip:SetDesiredAngle(-desiredAngle) LeftHip:SetDesiredAngle(-desiredAngle) end local tool = getTool() if tool and tool:FindFirstChild("Handle") then local animStringValueObject = getToolAnim(tool) if animStringValueObject then toolAnim = animStringValueObject.Value animStringValueObject.Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool() else stopToolAnimations() toolAnim = "None" toolAnimInstance = nil toolAnimTime = 0 end end Humanoid.Died:connect(onDied) Humanoid.Running:connect(onRunning) Humanoid.Jumping:connect(onJumping) Humanoid.Climbing:connect(onClimbing) Humanoid.GettingUp:connect(onGettingUp) Humanoid.FreeFalling:connect(onFreeFall) Humanoid.FallingDown:connect(onFallingDown) Humanoid.Seated:connect(onSeated) Humanoid.PlatformStanding:connect(onPlatformStanding) Humanoid.Swimming:connect(onSwimming) game:GetService("Players").LocalPlayer.Chatted:connect(function(msg) local emote = "" if msg == "/e dance" then emote = dances[math.random(1, #dances)] elseif (string.sub(msg, 1, 3) == "/e ") then emote = string.sub(msg, 4) elseif (string.sub(msg, 1, 7) == "/emote ") then emote = string.sub(msg, 8) end if (pose == "Standing" and emoteNames[emote] ~= nil) then playAnimation(emote, 0.1, Humanoid) end end) playAnimation("idle", 0.1, Humanoid) pose = "Standing" tdelay(0, function() while c do local _, time = wait(0.1) if (script.Parent == c) and (not script.Disabled) then move(time) end end end) end
  676. end
  677.  
  678. local torso1 = torso
  679. torso = gp(c, "Torso", "BasePart") or ((not R15toR6) and gp(c, torso.Name, "BasePart"))
  680. if (typeof(hedafterneck) == "Instance") and head and torso and torso1 then
  681. local conNeck, conTorso, conTorso1 = nil, nil, nil
  682. local aligns = {}
  683. local function enableAligns()
  684. conNeck:Disconnect()
  685. conTorso:Disconnect()
  686. conTorso1:Disconnect()
  687. for i, v in pairs(aligns) do
  688. v.Enabled = true
  689. end
  690. end
  691. conNeck = hedafterneck.Changed:Connect(function(prop)
  692. if table.find({"Part0", "Part1", "Parent"}, prop) then
  693. enableAligns()
  694. end
  695. end)
  696. conTorso = torso:GetPropertyChangedSignal("Parent"):Connect(enableAligns)
  697. conTorso1 = torso1:GetPropertyChangedSignal("Parent"):Connect(enableAligns)
  698. for i, v in pairs(getdescendants(head)) do
  699. if isa(v, "AlignPosition") or isa(v, "AlignOrientation") then
  700. i = tostring(i)
  701. aligns[i] = v
  702. v:GetPropertyChangedSignal("Parent"):Connect(function()
  703. aligns[i] = nil
  704. end)
  705. v.Enabled = false
  706. end
  707. end
  708. end
  709.  
  710. local flingpart0 = gp(model, flingpart, "BasePart") or gp(gp(model, flingpart, "Accessory"), "Handle", "BasePart")
  711. local flingpart1 = gp(c, flingpart, "BasePart") or gp(gp(c, flingpart, "Accessory"), "Handle", "BasePart")
  712.  
  713. local fling = function() end
  714. if flingpart0 and flingpart1 then
  715. flingpart0:GetPropertyChangedSignal("Parent"):Connect(function()
  716. if not (flingpart0 and flingpart0.Parent) then
  717. flingpart0 = nil
  718. fling = function() end
  719. end
  720. end)
  721. flingpart0.Archivable = true
  722. flingpart1:GetPropertyChangedSignal("Parent"):Connect(function()
  723. if not (flingpart1 and flingpart1.Parent) then
  724. flingpart1 = nil
  725. fling = function() end
  726. end
  727. end)
  728. local att0 = gp(flingpart0, "att0_" .. flingpart0.Name, "Attachment")
  729. local att1 = gp(flingpart1, "att1_" .. flingpart1.Name, "Attachment")
  730. if att0 and att1 then
  731. att0:GetPropertyChangedSignal("Parent"):Connect(function()
  732. if not (att0 and att0.Parent) then
  733. att0 = nil
  734. fling = function() end
  735. end
  736. end)
  737. att1:GetPropertyChangedSignal("Parent"):Connect(function()
  738. if not (att1 and att1.Parent) then
  739. att1 = nil
  740. fling = function() end
  741. end
  742. end)
  743. local lastfling = nil
  744. local mouse = lp:GetMouse()
  745. fling = function(target, duration, rotVelocity)
  746. if typeof(target) == "Instance" then
  747. if isa(target, "BasePart") then
  748. target = target.Position
  749. elseif isa(target, "Model") then
  750. target = gp(target, "HumanoidRootPart", "BasePart") or gp(target, "Torso", "BasePart") or gp(target, "UpperTorso", "BasePart") or target:FindFirstChildWhichIsA("BasePart")
  751. if target then
  752. target = target.Position
  753. else
  754. return
  755. end
  756. elseif isa(target, "Humanoid") then
  757. target = target.Parent
  758. if not (target and isa(target, "Model")) then
  759. return
  760. end
  761. target = gp(target, "HumanoidRootPart", "BasePart") or gp(target, "Torso", "BasePart") or gp(target, "UpperTorso", "BasePart") or target:FindFirstChildWhichIsA("BasePart")
  762. if target then
  763. target = target.Position
  764. else
  765. return
  766. end
  767. else
  768. return
  769. end
  770. elseif typeof(target) == "CFrame" then
  771. target = target.Position
  772. elseif typeof(target) ~= "Vector3" then
  773. target = mouse.Hit
  774. if target then
  775. target = target.Position
  776. else
  777. return
  778. end
  779. end
  780. if target.Y < ws xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed flingpart.Name = "flingpart_" xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed> 0.5 then
  781. flingpart0.Transparency = 0.5
  782. end
  783. att1.Parent = flingpart
  784. local con = nil
  785. local rotchg = v3(0, rotVelocity.Unit.Y * -1000, 0)
  786. con = heartbeat:Connect(function(delta)
  787. if target and (lastfling == target) and flingpart and flingpart0 and flingpart1 and att0 and att1 then
  788. flingpart.Orientation += rotchg * delta
  789. flingpart0.RotVelocity = rotVelocity
  790. else
  791. con:Disconnect()
  792. end
  793. end)
  794. if alignmode ~= 4 then
  795. local con = nil
  796. con = renderstepped:Connect(function()
  797. if flingpart0 and target then
  798. flingpart0.RotVelocity = v3_0
  799. else
  800. con:Disconnect()
  801. end
  802. end)
  803. end
  804. twait(duration)
  805. if lastfling ~= target then
  806. if flingpart then
  807. if att1 and (att1.Parent == flingpart) then
  808. att1.Parent = flingpart1
  809. end
  810. pcall(destroy, flingpart)
  811. end
  812. return
  813. end
  814. target = nil
  815. if not (flingpart and flingpart0 and flingpart1 and att0 and att1) then
  816. return
  817. end
  818. flingpart0.RotVelocity = v3_0
  819. att1.Parent = flingpart1
  820. pcall(destroy, flingpart)
  821. end
  822. end
  823. end
  824.  
  825.  
  826. wait(5)
  827.  
  828. char = workspace[lp.Name]
  829.  
  830. game.Players.LocalPlayer.Chatted:Connect(function(chat)
  831. if chat:match("/e chat ") then
  832. e = string.gsub(chat,"/e chat ","")
  833. for i , v in pairs(game.Players:GetDescendants()) do
  834. if v.ClassName == "Player" and v.DisplayName == e then
  835. target = workspace[v.Name].Head
  836. end
  837. end
  838. end
  839. end)
  840.  
  841. target = char.Head
  842. targetpos = Vector3.new()
  843. char.Head.Anchored = true
  844. char.Head.CanCollide = false
  845. char.HumanoidRootPart.Anchored = true
  846. char.HumanoidRootPart.CanCollide = false
  847.  
  848. char.Torso.Neck:Destroy()
  849.  
  850. while task.wait() do
  851. targetpos = target.Position
  852. char.Head.CFrame = CFrame.new() + targetpos
  853. char.HumanoidRootPart.CFrame = CFrame.new() + targetpos
  854. end
Add Comment
Please, Sign In to add comment