Advertisement
olapessoal123

Sonic script Roblox (goodguyaiden)

Jun 13th, 2018
15,227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.54 KB | None | 0 0
  1. ------------------------
  2.  
  3. --Made by goodguyaiden--
  4. --Sonic-----------------
  5.  
  6. ------------------------
  7. Sound0 = Instance.new("Sound")
  8. Sound0.Volume = 10
  9. Sound0.Parent = game.Players.LocalPlayer.Character.Head
  10. Sound0.SoundId = "rbxassetid://149573450"
  11. Sound0.Looped = true
  12. Sound0:Play()
  13. wait(0.8)
  14. Player=game:GetService("Players").LocalPlayer
  15. Character=Player.Character
  16. PlayerGui=Player.PlayerGui
  17. Backpack=Player.Backpack
  18. Torso=Character.Torso
  19. Head=Character.Head
  20. Humanoid=Character.Humanoid
  21. m=Instance.new('Model',Character)
  22. LeftArm=Character["Left Arm"]
  23. LeftLeg=Character["Left Leg"]
  24. RightArm=Character["Right Arm"]
  25. RightLeg=Character["Right Leg"]
  26. LS=Torso["Left Shoulder"]
  27. LH=Torso["Left Hip"]
  28. RS=Torso["Right Shoulder"]
  29. RH=Torso["Right Hip"]
  30. Face = Head.face
  31. Neck=Torso.Neck
  32. it=Instance.new
  33. attacktype=1
  34. vt=Vector3.new
  35. cf=CFrame.new
  36. cl3=Color3.new
  37. rgb=Color3.fromRGB
  38. bcn=BrickColor.new
  39. euler=CFrame.fromEulerAnglesXYZ
  40. angles=CFrame.Angles
  41. Humanoid.WalkSpeed = 30
  42. Player = game:GetService("Players").LocalPlayer
  43. PlayerGui = Player.PlayerGui
  44. Cam = workspace.CurrentCamera
  45. Backpack = Player.Backpack
  46. Character = Player.Character
  47. Humanoid = Character.Humanoid
  48. Mouse = Player:GetMouse()
  49. RootPart = Character["HumanoidRootPart"]
  50. Torso = Character["Torso"]
  51. Head = Character["Head"]
  52. RightArm = Character["Right Arm"]
  53. LeftArm = Character["Left Arm"]
  54. RightLeg = Character["Right Leg"]
  55. LeftLeg = Character["Left Leg"]
  56. RootJoint = RootPart["RootJoint"]
  57. Neck = Torso["Neck"]
  58. RightShoulder = Torso["Right Shoulder"]
  59. LeftShoulder = Torso["Left Shoulder"]
  60. RightHip = Torso["Right Hip"]
  61. LeftHip = Torso["Left Hip"]
  62. IT = Instance.new
  63. CF = CFrame.new
  64. VT = Vector3.new
  65. RAD = math.rad
  66. C3 = Color3.new
  67. UD2 = UDim2.new
  68. BRICKC = BrickColor.new
  69. ANGLES = CFrame.Angles
  70. EULER = CFrame.fromEulerAnglesXYZ
  71. COS = math.cos
  72. ACOS = math.acos
  73. SIN = math.sin
  74. ASIN = math.asin
  75. ABS = math.abs
  76. MRANDOM = math.random
  77. FLOOR = math.floor
  78. Animation_Speed = 3
  79. Frame_Speed = 1 / 60 -- (1 / 30) OR (1 / 60)
  80. local Speed = 12
  81. local ROOTC0 = CF(0, 0, 0) * ANGLES(RAD(-90), RAD(0), RAD(180))
  82. local NECKC0 = CF(0, 1, 0) * ANGLES(RAD(-90), RAD(0), RAD(180))
  83. local RIGHTSHOULDERC0 = CF(-0.5, 0, 0) * ANGLES(RAD(0), RAD(90), RAD(0))
  84. local LEFTSHOULDERC0 = CF(0.5, 0, 0) * ANGLES(RAD(0), RAD(-90), RAD(0))
  85. local DAMAGEMULTIPLIER = 1
  86. local ANIM = "Idle"
  87. local ATTACK = false
  88. local EQUIPPED = false
  89. local HOLD = false
  90. local COMBO = 1
  91. local Rooted = false
  92. local SINE = 0
  93. local KEYHOLD = false
  94. local CHANGE = 2 / Animation_Speed
  95. local WALKINGANIM = false
  96. local VALUE1 = false
  97. local VALUE2 = false
  98. local ROBLOXIDLEANIMATION = IT("Animation")
  99. ROBLOXIDLEANIMATION.Name = "Roblox Idle Animation"
  100. ROBLOXIDLEANIMATION.AnimationId = "http://www.roblox.com/asset/?id=180435571"
  101. --ROBLOXIDLEANIMATION.Parent = Humanoid
  102. local WEAPONGUI = IT("ScreenGui", PlayerGui)
  103. WEAPONGUI.Name = "Weapon GUI"
  104. local Weapon = IT("Model")
  105. Weapon.Name = "Adds"
  106. local Effects = IT("Folder", Weapon)
  107. Effects.Name = "Effects"
  108. local ANIMATOR = Humanoid.Animator
  109. local ANIMATE = Character.Animate
  110. local UNANCHOR = true
  111. local PLAYANIMS = true
  112. ArtificialHB = Instance.new("BindableEvent", script)
  113. ArtificialHB.Name = "ArtificialHB"
  114.  
  115. script:WaitForChild("ArtificialHB")
  116.  
  117. frame = Frame_Speed
  118. tf = 0
  119. allowframeloss = false
  120. tossremainder = false
  121. lastframe = tick()
  122. script.ArtificialHB:Fire()
  123.  
  124. game:GetService("RunService").Heartbeat:connect(function(s, p)
  125. tf = tf + s
  126. if tf >= frame then
  127. if allowframeloss then
  128. script.ArtificialHB:Fire()
  129. lastframe = tick()
  130. else
  131. for i = 1, math.floor(tf / frame) do
  132. script.ArtificialHB:Fire()
  133. end
  134. lastframe = tick()
  135. end
  136. if tossremainder then
  137. tf = 0
  138. else
  139. tf = tf - frame * math.floor(tf / frame)
  140. end
  141. end
  142. end)
  143. function Raycast(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS)
  144. return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS)
  145. end
  146.  
  147. function PositiveAngle(NUMBER)
  148. if NUMBER >= 0 then
  149. NUMBER = 0
  150. end
  151. return NUMBER
  152. end
  153.  
  154. function NegativeAngle(NUMBER)
  155. if NUMBER <= 0 then
  156. NUMBER = 0
  157. end
  158. return NUMBER
  159. end
  160.  
  161. function Swait(NUMBER)
  162. if NUMBER == 0 or NUMBER == nil then
  163. ArtificialHB.Event:wait()
  164. else
  165. for i = 1, NUMBER do
  166. ArtificialHB.Event:wait()
  167. end
  168. end
  169. end
  170.  
  171. function CreateMesh(MESH, PARENT, MESHTYPE, MESHID, TEXTUREID, SCALE, OFFSET)
  172. local NEWMESH = IT(MESH)
  173. if MESH == "SpecialMesh" then
  174. NEWMESH.MeshType = MESHTYPE
  175. if MESHID ~= "nil" and MESHID ~= "" then
  176. NEWMESH.MeshId = "http://www.roblox.com/asset/?id="..MESHID
  177. end
  178. if TEXTUREID ~= "nil" and TEXTUREID ~= "" then
  179. NEWMESH.TextureId = "http://www.roblox.com/asset/?id="..TEXTUREID
  180. end
  181. end
  182. NEWMESH.Offset = OFFSET or VT(0, 0, 0)
  183. NEWMESH.Scale = SCALE
  184. NEWMESH.Parent = PARENT
  185. return NEWMESH
  186. end
  187.  
  188. function CreatePart(FORMFACTOR, PARENT, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR)
  189. local NEWPART = IT("Part")
  190. NEWPART.formFactor = FORMFACTOR
  191. NEWPART.Reflectance = REFLECTANCE
  192. NEWPART.Transparency = TRANSPARENCY
  193. NEWPART.CanCollide = false
  194. NEWPART.Locked = true
  195. NEWPART.Anchored = true
  196. if ANCHOR == false then
  197. NEWPART.Anchored = false
  198. end
  199. NEWPART.BrickColor = BRICKC(tostring(BRICKCOLOR))
  200. NEWPART.Name = NAME
  201. NEWPART.Size = SIZE
  202. NEWPART.Position = Torso.Position
  203. NEWPART.Material = MATERIAL
  204. NEWPART:BreakJoints()
  205. NEWPART.Parent = PARENT
  206. return NEWPART
  207. end
  208.  
  209. local function weldBetween(a, b)
  210. local weldd = Instance.new("ManualWeld")
  211. weldd.Part0 = a
  212. weldd.Part1 = b
  213. weldd.C0 = CFrame.new()
  214. weldd.C1 = b.CFrame:inverse() * a.CFrame
  215. weldd.Parent = a
  216. return weldd
  217. end
  218.  
  219.  
  220. function QuaternionFromCFrame(cf)
  221. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  222. local trace = m00 + m11 + m22
  223. if trace > 0 then
  224. local s = math.sqrt(1 + trace)
  225. local recip = 0.5 / s
  226. return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
  227. else
  228. local i = 0
  229. if m11 > m00 then
  230. i = 1
  231. end
  232. if m22 > (i == 0 and m00 or m11) then
  233. i = 2
  234. end
  235. if i == 0 then
  236. local s = math.sqrt(m00 - m11 - m22 + 1)
  237. local recip = 0.5 / s
  238. return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
  239. elseif i == 1 then
  240. local s = math.sqrt(m11 - m22 - m00 + 1)
  241. local recip = 0.5 / s
  242. return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
  243. elseif i == 2 then
  244. local s = math.sqrt(m22 - m00 - m11 + 1)
  245. local recip = 0.5 / s return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
  246. end
  247. end
  248. end
  249.  
  250. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  251. local xs, ys, zs = x + x, y + y, z + z
  252. local wx, wy, wz = w * xs, w * ys, w * zs
  253. local xx = x * xs
  254. local xy = x * ys
  255. local xz = x * zs
  256. local yy = y * ys
  257. local yz = y * zs
  258. local zz = z * zs
  259. return CFrame.new(px, py, pz, 1 - (yy + zz), xy - wz, xz + wy, xy + wz, 1 - (xx + zz), yz - wx, xz - wy, yz + wx, 1 - (xx + yy))
  260. end
  261.  
  262. function QuaternionSlerp(a, b, t)
  263. local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
  264. local startInterp, finishInterp;
  265. if cosTheta >= 0.0001 then
  266. if (1 - cosTheta) > 0.0001 then
  267. local theta = ACOS(cosTheta)
  268. local invSinTheta = 1 / SIN(theta)
  269. startInterp = SIN((1 - t) * theta) * invSinTheta
  270. finishInterp = SIN(t * theta) * invSinTheta
  271. else
  272. startInterp = 1 - t
  273. finishInterp = t
  274. end
  275. else
  276. if (1 + cosTheta) > 0.0001 then
  277. local theta = ACOS(-cosTheta)
  278. local invSinTheta = 1 / SIN(theta)
  279. startInterp = SIN((t - 1) * theta) * invSinTheta
  280. finishInterp = SIN(t * theta) * invSinTheta
  281. else
  282. startInterp = t - 1
  283. finishInterp = t
  284. end
  285. end
  286. return a[1] * startInterp + b[1] * finishInterp, a[2] * startInterp + b[2] * finishInterp, a[3] * startInterp + b[3] * finishInterp, a[4] * startInterp + b[4] * finishInterp
  287. end
  288.  
  289. function Clerp(a, b, t)
  290. local qa = {QuaternionFromCFrame(a)}
  291. local qb = {QuaternionFromCFrame(b)}
  292. local ax, ay, az = a.x, a.y, a.z
  293. local bx, by, bz = b.x, b.y, b.z
  294. local _t = 1 - t
  295. return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
  296. end
  297.  
  298. function CreateFrame(PARENT, TRANSPARENCY, BORDERSIZEPIXEL, POSITION, SIZE, COLOR, BORDERCOLOR, NAME)
  299. local frame = IT("Frame")
  300. frame.BackgroundTransparency = TRANSPARENCY
  301. frame.BorderSizePixel = BORDERSIZEPIXEL
  302. frame.Position = POSITION
  303. frame.Size = SIZE
  304. frame.BackgroundColor3 = COLOR
  305. frame.BorderColor3 = BORDERCOLOR
  306. frame.Name = NAME
  307. frame.Parent = PARENT
  308. return frame
  309. end
  310.  
  311. function CreateLabel(PARENT, TEXT, TEXTCOLOR, TEXTFONTSIZE, TEXTFONT, TRANSPARENCY, BORDERSIZEPIXEL, STROKETRANSPARENCY, NAME)
  312. local label = IT("TextLabel")
  313. label.BackgroundTransparency = 1
  314. label.Size = UD2(1, 0, 1, 0)
  315. label.Position = UD2(0, 0, 0, 0)
  316. label.TextColor3 = TEXTCOLOR
  317. label.TextStrokeTransparency = STROKETRANSPARENCY
  318. label.TextTransparency = TRANSPARENCY
  319. label.FontSize = TEXTFONTSIZE
  320. label.Font = TEXTFONT
  321. label.BorderSizePixel = BORDERSIZEPIXEL
  322. label.TextScaled = false
  323. label.Text = TEXT
  324. label.Name = NAME
  325. label.Parent = PARENT
  326. return label
  327. end
  328.  
  329. function NoOutlines(PART)
  330. PART.TopSurface, PART.BottomSurface, PART.LeftSurface, PART.RightSurface, PART.FrontSurface, PART.BackSurface = 10, 10, 10, 10, 10, 10
  331. end
  332.  
  333. function CreateWeldOrSnapOrMotor(TYPE, PARENT, PART0, PART1, C0, C1)
  334. local NEWWELD = IT(TYPE)
  335. NEWWELD.Part0 = PART0
  336. NEWWELD.Part1 = PART1
  337. NEWWELD.C0 = C0
  338. NEWWELD.C1 = C1
  339. NEWWELD.Parent = PARENT
  340. return NEWWELD
  341. end
  342.  
  343. local S = IT("Sound")
  344. function CreateSound(ID, PARENT, VOLUME, PITCH, DOESLOOP)
  345. local NEWSOUND = nil
  346. coroutine.resume(coroutine.create(function()
  347. NEWSOUND = S:Clone()
  348. NEWSOUND.Parent = PARENT
  349. NEWSOUND.Volume = VOLUME
  350. NEWSOUND.Pitch = PITCH
  351. NEWSOUND.SoundId = "http://www.roblox.com/asset/?id="..ID
  352. NEWSOUND:play()
  353. if DOESLOOP == true then
  354. NEWSOUND.Looped = true
  355. else
  356. repeat wait(1) until NEWSOUND.Playing == false
  357. NEWSOUND:remove()
  358. end
  359. end))
  360. return NEWSOUND
  361. end
  362.  
  363. function MakeForm(PART,TYPE)
  364. if TYPE == "Cyl" then
  365. local MSH = IT("CylinderMesh",PART)
  366. elseif TYPE == "Ball" then
  367. local MSH = IT("SpecialMesh",PART)
  368. MSH.MeshType = "Sphere"
  369. elseif TYPE == "Wedge" then
  370. local MSH = IT("SpecialMesh",PART)
  371. MSH.MeshType = "Wedge"
  372. end
  373. end
  374.  
  375. function CFrameFromTopBack(at, top, back)
  376. local right = top:Cross(back)
  377. return CF(at.x, at.y, at.z, right.x, top.x, back.x, right.y, top.y, back.y, right.z, top.z, back.z)
  378. end
  379.  
  380. function PuddleOfBlood(Position,MaxDrop,Model,MaxSize)
  381. local HITFLOOR, HITPOS, NORMAL = Raycast(Position, (CF(Position, Position + VT(0, -1, 0))).lookVector, MaxDrop, Model)
  382. if HITFLOOR ~= nil then
  383. if HITFLOOR.Parent ~= Weapon and HITFLOOR.Parent ~= Character then
  384. if HITFLOOR.Name == "BloodPuddle" then
  385. local DIST = (Position - HITFLOOR.Position).Magnitude
  386. if (HITFLOOR.Size.Z <= 5 and HITFLOOR.Size.Z < MaxSize) or (HITFLOOR.Size.Z > 5 and HITFLOOR.Size.Z < MaxSize and DIST < HITFLOOR.Size.Z/3) then
  387. HITFLOOR.Size = HITFLOOR.Size + VT(0.1,0,0.1)
  388. end
  389. else
  390. if HITFLOOR.Anchored == true then
  391. local BLOOD = CreatePart(3, Effects, "Glass", 0, 0, "Maroon", "BloodPuddle", VT(2,0,2))
  392. BLOOD.CFrame = CF(HITPOS,HITPOS+NORMAL)*ANGLES(RAD(90),RAD(0),RAD(0))
  393. MakeForm(BLOOD,"Cyl")
  394. coroutine.resume(coroutine.create(function()
  395. Swait(75)
  396. while true do
  397. Swait()
  398. BLOOD.Size = BLOOD.Size - VT(0.02,0,0.02)
  399. if BLOOD.Size.Z < 0.051 then
  400. BLOOD:remove()
  401. break
  402. end
  403. end
  404. end))
  405. end
  406. end
  407. end
  408. end
  409. end
  410.  
  411. function SprayBlood(POSITION,DIRECTION,BloodSize)
  412. local BLOOD = CreatePart(3, Effects, "Glass", 0, 0, "Maroon", "BloodPuddle", VT(0.3,0.3,0.3),false)
  413. BLOOD.CFrame = CF(POSITION)
  414. MakeForm(BLOOD,"Ball")
  415. local bv = Instance.new("BodyVelocity",BLOOD)
  416. bv.maxForce = Vector3.new(1e9, 1e9, 1e9)
  417. bv.velocity = CF(POSITION,DIRECTION+VT(MRANDOM(-3,3)/30,MRANDOM(-3,3)/30,MRANDOM(-3,3)/30)).lookVector*75
  418. bv.Name = "MOVE"
  419. Debris:AddItem(bv,0.05)
  420. coroutine.resume(coroutine.create(function()
  421. local HASTOUCHEDGROUND = false
  422. local HIT = BLOOD.Touched:Connect(function(hit)
  423. if hit.Anchored == true then
  424. HASTOUCHEDGROUND = true
  425. PuddleOfBlood(BLOOD.Position+VT(0,1,0),2,BLOOD,BloodSize)
  426. end
  427. end)
  428. wait(5)
  429. if HASTOUCHEDGROUND == false then
  430. BLOOD:remove()
  431. end
  432. end))
  433. end
  434.  
  435. Debris = game:GetService("Debris")
  436.  
  437. function CastProperRay(StartPos, EndPos, Distance, Ignore)
  438. local DIRECTION = CF(StartPos,EndPos).lookVector
  439. return Raycast(StartPos, DIRECTION, Distance, Ignore)
  440. end
  441.  
  442. function turnto(position)
  443. RootPart.CFrame=CFrame.new(RootPart.CFrame.p,VT(position.X,RootPart.Position.Y,position.Z)) * CFrame.new(0, 0, 0)
  444. end
  445.  
  446. function recurse(root,callback,i)
  447. i= i or 0
  448. for _,v in pairs(root:GetChildren()) do
  449. i = i + 1
  450. callback(i,v)
  451.  
  452. if #v:GetChildren() > 0 then
  453. i = recurse(v,callback,i)
  454. end
  455. end
  456.  
  457. return i
  458. end
  459.  
  460. function ragdollJoint(character, part0, part1, attachmentName, className, properties)
  461. attachmentName = attachmentName.."RigAttachment"
  462. local constraint = Instance.new(className.."Constraint")
  463. constraint.Attachment0 = part0:FindFirstChild(attachmentName)
  464. constraint.Attachment1 = part1:FindFirstChild(attachmentName)
  465. constraint.Name = "RagdollConstraint"..part1.Name
  466.  
  467. for _,propertyData in next,properties or {} do
  468. constraint[propertyData[1]] = propertyData[2]
  469. end
  470.  
  471. constraint.Parent = character
  472. end
  473.  
  474. function getAttachment0(character, attachmentName)
  475. for _,child in next,character:GetChildren() do
  476. local attachment = child:FindFirstChild(attachmentName)
  477. if attachment then
  478. return attachment
  479. end
  480. end
  481. end
  482.  
  483. function R15Ragdoll(character)
  484. recurse(character, function(_,v)
  485. if v:IsA("Attachment") then
  486. v.Axis = Vector3.new(0, 1, 0)
  487. v.SecondaryAxis = Vector3.new(0, 0, 1)
  488. v.Rotation = Vector3.new(0, 0, 0)
  489. end
  490. end)
  491. for _,child in next,character:GetChildren() do
  492. if child:IsA("Accoutrement") then
  493. for _,part in next,child:GetChildren() do
  494. if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
  495. local attachment1 = part:FindFirstChildOfClass("Attachment")
  496. local attachment0 = getAttachment0(character,attachment1.Name)
  497. if attachment0 and attachment1 then
  498. local constraint = Instance.new("HingeConstraint")
  499. constraint.Attachment0 = attachment0
  500. constraint.Attachment1 = attachment1
  501. constraint.LimitsEnabled = true
  502. constraint.UpperAngle = 0
  503. constraint.LowerAngle = 0
  504. constraint.Parent = character
  505. end
  506. elseif part.Name == "HumanoidRootPart" then
  507. part:remove()
  508. end
  509. end
  510. end
  511. end
  512.  
  513. ragdollJoint(character,character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
  514. {"LimitsEnabled",true};
  515. {"UpperAngle",5};
  516. })
  517. ragdollJoint(character,character.UpperTorso, character.Head, "Neck", "BallSocket", {
  518. {"LimitsEnabled",true};
  519. {"UpperAngle",15};
  520. })
  521.  
  522. local handProperties = {
  523. {"LimitsEnabled", true};
  524. {"UpperAngle",0};
  525. {"LowerAngle",0};
  526. }
  527. ragdollJoint(character,character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
  528. ragdollJoint(character,character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)
  529.  
  530. local shinProperties = {
  531. {"LimitsEnabled", true};
  532. {"UpperAngle", 0};
  533. {"LowerAngle", -75};
  534. }
  535. ragdollJoint(character,character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
  536. ragdollJoint(character,character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)
  537.  
  538. local footProperties = {
  539. {"LimitsEnabled", true};
  540. {"UpperAngle", 15};
  541. {"LowerAngle", -45};
  542. }
  543. ragdollJoint(character,character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
  544. ragdollJoint(character,character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)
  545.  
  546. ragdollJoint(character,character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
  547. ragdollJoint(character,character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
  548. ragdollJoint(character,character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
  549. ragdollJoint(character,character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
  550. ragdollJoint(character,character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
  551. ragdollJoint(character,character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")
  552. end
  553.  
  554. function Ragdoll(Character2,CharTorso)
  555. Character2:BreakJoints()
  556. local hum = Character2:findFirstChild("Humanoid")
  557. hum:remove()
  558. local function Scan(ch)
  559. local e
  560. for e = 1,#ch do
  561. Scan(ch[e]:GetChildren())
  562. if ch[e].ClassName == "Weld" or ch[e].ClassName == "Motor6D" then
  563. ch[e]:remove()
  564. end
  565. end
  566. end
  567. local NEWHUM = IT("Humanoid")
  568. NEWHUM.Name = "Corpse"
  569. NEWHUM.Health = 0
  570. NEWHUM.MaxHealth = 0
  571. NEWHUM.PlatformStand = true
  572. NEWHUM.Parent = Character2
  573. NEWHUM.DisplayDistanceType = "None"
  574.  
  575. local ch = Character2:GetChildren()
  576. local i
  577. for i = 1,#ch do
  578. if ch[i].Name == "THandle1" or ch[i].Name == "THandle2" then
  579. ch[i]:remove()
  580. end
  581. end
  582.  
  583. local Torso2 = Character2.Torso
  584. local movevector = Vector3.new()
  585.  
  586. if Torso2 then
  587. movevector = CFrame.new(CharTorso.Position,Torso2.Position).lookVector
  588. local Head = Character2:FindFirstChild("Head")
  589. if Head then
  590. local Neck = Instance.new("Weld")
  591. Neck.Name = "Neck"
  592. Neck.Part0 = Torso2
  593. Neck.Part1 = Head
  594. Neck.C0 = CFrame.new(0, 1.5, 0)
  595. Neck.C1 = CFrame.new()
  596. Neck.Parent = Torso2
  597.  
  598. end
  599. local Limb = Character2:FindFirstChild("Right Arm")
  600. if Limb then
  601.  
  602. Limb.CFrame = Torso2.CFrame * CFrame.new(1.5, 0, 0)
  603. local Joint = Instance.new("Glue")
  604. Joint.Name = "RightShoulder"
  605. Joint.Part0 = Torso2
  606. Joint.Part1 = Limb
  607. Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  608. Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  609. Joint.Parent = Torso2
  610.  
  611. local B = Instance.new("Part")
  612. B.TopSurface = 0
  613. B.BottomSurface = 0
  614. B.formFactor = "Symmetric"
  615. B.Size = Vector3.new(1, 1, 1)
  616. B.Transparency = 1
  617. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  618. B.Parent = Character2
  619. local W = Instance.new("Weld")
  620. W.Part0 = Limb
  621. W.Part1 = B
  622. W.C0 = CFrame.new(0, -0.5, 0)
  623. W.Parent = Limb
  624.  
  625. end
  626. local Limb = Character2:FindFirstChild("Left Arm")
  627. if Limb then
  628.  
  629. Limb.CFrame = Torso2.CFrame * CFrame.new(-1.5, 0, 0)
  630. local Joint = Instance.new("Glue")
  631. Joint.Name = "LeftShoulder"
  632. Joint.Part0 = Torso2
  633. Joint.Part1 = Limb
  634. Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  635. Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  636. Joint.Parent = Torso2
  637.  
  638. local B = Instance.new("Part")
  639. B.TopSurface = 0
  640. B.BottomSurface = 0
  641. B.formFactor = "Symmetric"
  642. B.Size = Vector3.new(1, 1, 1)
  643. B.Transparency = 1
  644. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  645. B.Parent = Character2
  646. local W = Instance.new("Weld")
  647. W.Part0 = Limb
  648. W.Part1 = B
  649. W.C0 = CFrame.new(0, -0.5, 0)
  650. W.Parent = Limb
  651.  
  652. end
  653. local Limb = Character2:FindFirstChild("Right Leg")
  654. if Limb then
  655.  
  656. Limb.CFrame = Torso2.CFrame * CFrame.new(0.5, -2, 0)
  657. local Joint = Instance.new("Glue")
  658. Joint.Name = "RightHip"
  659. Joint.Part0 = Torso2
  660. Joint.Part1 = Limb
  661. Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  662. Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  663. Joint.Parent = Torso2
  664.  
  665. local B = Instance.new("Part")
  666. B.TopSurface = 0
  667. B.BottomSurface = 0
  668. B.formFactor = "Symmetric"
  669. B.Size = Vector3.new(1, 1, 1)
  670. B.Transparency = 1
  671. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  672. B.Parent = Character2
  673. local W = Instance.new("Weld")
  674. W.Part0 = Limb
  675. W.Part1 = B
  676. W.C0 = CFrame.new(0, -0.5, 0)
  677. W.Parent = Limb
  678.  
  679. end
  680. local Limb = Character2:FindFirstChild("Left Leg")
  681. if Limb then
  682.  
  683. Limb.CFrame = Torso2.CFrame * CFrame.new(-0.5, -2, 0)
  684. local Joint = Instance.new("Glue")
  685. Joint.Name = "LeftHip"
  686. Joint.Part0 = Torso2
  687. Joint.Part1 = Limb
  688. Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  689. Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  690. Joint.Parent = Torso2
  691.  
  692. local B = Instance.new("Part")
  693. B.TopSurface = 0
  694. B.BottomSurface = 0
  695. B.formFactor = "Symmetric"
  696. B.Size = Vector3.new(1, 1, 1)
  697. B.Transparency = 1
  698. B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  699. B.Parent = Character2
  700. local W = Instance.new("Weld")
  701. W.Part0 = Limb
  702. W.Part1 = B
  703. W.C0 = CFrame.new(0, -0.5, 0)
  704. W.Parent = Limb
  705.  
  706. end
  707. --[
  708. local Bar = Instance.new("Part")
  709. Bar.TopSurface = 0
  710. Bar.BottomSurface = 0
  711. Bar.formFactor = "Symmetric"
  712. Bar.Size = Vector3.new(1, 1, 1)
  713. Bar.Transparency = 1
  714. Bar.CFrame = Torso2.CFrame * CFrame.new(0, 0.5, 0)
  715. Bar.Parent = Character2
  716. local Weld = Instance.new("Weld")
  717. Weld.Part0 = Torso2
  718. Weld.Part1 = Bar
  719. Weld.C0 = CFrame.new(0, 0.5, 0)
  720. Weld.Parent = Torso2
  721. --]]
  722. end
  723. Character2.Parent = workspace
  724. Debris:AddItem(Character2,5)
  725.  
  726. return Character2,Torso2
  727. end
  728.  
  729. function Taunt()
  730. ATTACK = true
  731. Rooted = true
  732. CreateSound("135557803", Head, 10, 1)
  733. for i=0, 1, 0.1 / Animation_Speed do
  734. Swait()
  735. RootJoint.C0 = Clerp(RootJoint.C0,ROOTC0 * CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.5 / Animation_Speed)
  736. Neck.C0 = Clerp(Neck.C0, NECKC0 * CF(0, 0, 0 + ((1) - 1)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.5 / Animation_Speed)
  737. RightShoulder.C0 = Clerp(RightShoulder.C0, CF(1.5, 0.55, 0) * ANGLES(RAD(170), RAD(0), RAD(30)) * RIGHTSHOULDERC0, 0.5 / Animation_Speed)
  738. LeftShoulder.C0 = Clerp(LeftShoulder.C0, CF(-1.5, 0.55, 0) * ANGLES(RAD(170), RAD(0), RAD(-30)) * LEFTSHOULDERC0, 0.5 / Animation_Speed)
  739. RightHip.C0 = Clerp(RightHip.C0, CF(1, -1 - 0.05 * COS(SINE / 12), -0.01) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-8), RAD(0), RAD(0)), 0.5 / Animation_Speed)
  740. LeftHip.C0 = Clerp(LeftHip.C0, CF(-1, -1 - 0.05 * COS(SINE / 12), -0.01) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(-8), RAD(0), RAD(0)), 0.5 / Animation_Speed)
  741. end
  742. wait(1)
  743. ATTACK = false
  744. Rooted = false
  745. end
  746.  
  747.  
  748. function Gottagofaster()
  749. CreateSound("1277484413", Head, 10, 1)
  750. Humanoid.WalkSpeed = 46
  751. wait(8)
  752. Humanoid.WalkSpeed = 30
  753. end
  754.  
  755. function MouseDown(Mouse)
  756. HOLD = true
  757. if ATTACK == false then
  758. end
  759. end
  760.  
  761. function MouseUp(Mouse)
  762. HOLD = false
  763. end
  764.  
  765. function KeyDown(Key)
  766. KEYHOLD = true
  767. if Key == "t" and ATTACK == false then
  768. Taunt()
  769. end
  770.  
  771. if Key == "z" and ATTACK == false then
  772. Gottagofaster()
  773. end
  774. end
  775.  
  776. function KeyUp(Key)
  777. KEYHOLD = false
  778. end
  779.  
  780. Mouse.Button1Down:connect(function(NEWKEY)
  781. MouseDown(NEWKEY)
  782. end)
  783. Mouse.Button1Up:connect(function(NEWKEY)
  784. MouseUp(NEWKEY)
  785. end)
  786. Mouse.KeyDown:connect(function(NEWKEY)
  787. KeyDown(NEWKEY)
  788. end)
  789. Mouse.KeyUp:connect(function(NEWKEY)
  790. KeyUp(NEWKEY)
  791. end)
  792.  
  793.  
  794. Humanoid.Changed:connect(function(Jump)
  795. if Jump == "Jump" and (Disable_Jump == true) then
  796. Humanoid.Jump = false
  797. end
  798. end)
  799.  
  800. while true do
  801. Swait()
  802. script.Parent = WEAPONGUI
  803. ANIMATE.Parent = nil
  804. for _,v in next, Humanoid:GetPlayingAnimationTracks() do
  805. v:Stop();
  806. end
  807. SINE = SINE + CHANGE
  808. local TORSOVELOCITY = (RootPart.Velocity * VT(1, 0, 1)).magnitude
  809. local TORSOVERTICALVELOCITY = RootPart.Velocity.y
  810. local HITFLOOR = Raycast(RootPart.Position, (CF(RootPart.Position, RootPart.Position + VT(0, -1, 0))).lookVector, 4, Character)
  811. local WALKSPEEDVALUE = 6 / (Humanoid.WalkSpeed / 16)
  812. if ANIM == "Walk" and TORSOVELOCITY > 1 then
  813. RootJoint.C1 = Clerp(RootJoint.C1, ROOTC0 * CF(0, 0, -0.15 * COS(SINE / (WALKSPEEDVALUE / 2))) * ANGLES(RAD(0), RAD(0) - RootPart.RotVelocity.Y / 75, RAD(0)), 2 * (Humanoid.WalkSpeed / 16) / Animation_Speed)
  814. Neck.C1 = Clerp(Neck.C1, CF(0, -0.5, 0) * ANGLES(RAD(-90), RAD(0), RAD(180)) * ANGLES(RAD(2.5 * SIN(SINE / (WALKSPEEDVALUE / 2))), RAD(0), RAD(0) - Head.RotVelocity.Y / 30), 0.2 * (Humanoid.WalkSpeed / 16) / Animation_Speed)
  815. RightHip.C1 = Clerp(RightHip.C1, CF(0.5, 0.875 - 0.125 * SIN(SINE / WALKSPEEDVALUE) - 0.15 * COS(SINE / WALKSPEEDVALUE*2), -0.125 * COS(SINE / WALKSPEEDVALUE) +0.2+ 0.2 * COS(SINE / WALKSPEEDVALUE)) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(0) - RightLeg.RotVelocity.Y / 75, RAD(0), RAD(76 * COS(SINE / WALKSPEEDVALUE))), 0.3 * (Humanoid.WalkSpeed / 16) / Animation_Speed)
  816. LeftHip.C1 = Clerp(LeftHip.C1, CF(-0.5, 0.875 + 0.125 * SIN(SINE / WALKSPEEDVALUE) - 0.15 * COS(SINE / WALKSPEEDVALUE*2), 0.125 * COS(SINE / WALKSPEEDVALUE) +0.2+ -0.2 * COS(SINE / WALKSPEEDVALUE)) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(0) + LeftLeg.RotVelocity.Y / 75, RAD(0), RAD(76 * COS(SINE / WALKSPEEDVALUE))), 0.3 * (Humanoid.WalkSpeed / 16) / Animation_Speed)
  817. elseif (ANIM ~= "Walk") or (TORSOVELOCITY < 1) then
  818. RootJoint.C1 = Clerp(RootJoint.C1, ROOTC0 * CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  819. Neck.C1 = Clerp(Neck.C1, CF(0, -0.5, 0) * ANGLES(RAD(-90), RAD(0), RAD(180)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  820. RightHip.C1 = Clerp(RightHip.C1, CF(0.5, 1, 0) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  821. LeftHip.C1 = Clerp(LeftHip.C1, CF(-0.5, 1, 0) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  822. end
  823. if TORSOVERTICALVELOCITY > 1 and HITFLOOR == nil then
  824. ANIM = "Jump"
  825. if PLAYANIMS == true then
  826. RootJoint.C0 = Clerp(RootJoint.C0, ROOTC0 * CF(0, 0, 0) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  827. Neck.C0 = Clerp(Neck.C0, NECKC0 * CF(0, 0, 0 + ((1) - 1)) * ANGLES(RAD(-20), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  828. RightShoulder.C0 = Clerp(RightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(-40), RAD(0), RAD(20)) * RIGHTSHOULDERC0, 0.2 / Animation_Speed)
  829. LeftShoulder.C0 = Clerp(LeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(-40), RAD(0), RAD(-20)) * LEFTSHOULDERC0, 0.2 / Animation_Speed)
  830. RightHip.C0 = Clerp(RightHip.C0, CF(1, -1, -0.3) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(-5), RAD(0), RAD(-20)), 0.2 / Animation_Speed)
  831. LeftHip.C0 = Clerp(LeftHip.C0, CF(-1, -1, -0.3) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(-5), RAD(0), RAD(20)), 0.2 / Animation_Speed)
  832. end
  833. elseif TORSOVERTICALVELOCITY < -1 and HITFLOOR == nil then
  834. ANIM = "Fall"
  835. if PLAYANIMS == true then
  836. RootJoint.C0 = Clerp(RootJoint.C0, ROOTC0 * CF(0, 0, 0 ) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  837. Neck.C0 = Clerp(Neck.C0, NECKC0 * CF(0, 0 , 0 + ((1) - 1)) * ANGLES(RAD(20), RAD(0), RAD(0)), 0.2 / Animation_Speed)
  838. RightShoulder.C0 = Clerp(RightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(60)) * RIGHTSHOULDERC0, 0.2 / Animation_Speed)
  839. LeftShoulder.C0 = Clerp(LeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(-60)) * LEFTSHOULDERC0, 0.2 / Animation_Speed)
  840. RightHip.C0 = Clerp(RightHip.C0, CF(1, -1, 0) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(20)), 0.2 / Animation_Speed)
  841. LeftHip.C0 = Clerp(LeftHip.C0, CF(-1, -1, 0) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(10)), 0.2 / Animation_Speed)
  842. end
  843. elseif TORSOVELOCITY < 1 and HITFLOOR ~= nil then
  844. ANIM = "Idle"
  845. if PLAYANIMS == true then
  846. RootJoint.C0 = Clerp(RootJoint.C0,ROOTC0 * CF(0, 0, 0 + 0.05 * COS(SINE / 12)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.15 / Animation_Speed)
  847. Neck.C0 = Clerp(Neck.C0, NECKC0 * CF(0, 0, 0 + ((1) - 1)) * ANGLES(RAD(0 - 2.5 * SIN(SINE / 12)), RAD(0), RAD(0)), 0.15 / Animation_Speed)
  848. RightShoulder.C0 = Clerp(RightShoulder.C0, CF(1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)) * RIGHTSHOULDERC0, 0.15 / Animation_Speed)
  849. LeftShoulder.C0 = Clerp(LeftShoulder.C0, CF(-1.5, 0.5, 0) * ANGLES(RAD(0), RAD(0), RAD(0)) * LEFTSHOULDERC0, 0.15 / Animation_Speed)
  850. RightHip.C0 = Clerp(RightHip.C0, CF(1, -1 - 0.05 * COS(SINE / 12), -0.01) * ANGLES(RAD(0), RAD(80), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.15 / Animation_Speed)
  851. LeftHip.C0 = Clerp(LeftHip.C0, CF(-1, -1 - 0.05 * COS(SINE / 12), -0.01) * ANGLES(RAD(0), RAD(-80), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(0)), 0.15 / Animation_Speed)
  852. end
  853. elseif TORSOVELOCITY > 1 and HITFLOOR ~= nil then
  854. ANIM = "Walk"
  855. if PLAYANIMS == true then
  856. RootJoint.C0 = Clerp(RootJoint.C0,ROOTC0 * CF(0, 0, -0.1) * ANGLES(RAD(35), RAD(0), RAD(5 * SIN(SINE / (WALKSPEEDVALUE / 2)))), 0.15 / Animation_Speed)
  857. Neck.C0 = Clerp(Neck.C0, NECKC0 * CF(0, 0, 0 + ((1) - 1)) * ANGLES(RAD(-25 - 1 * SIN(SINE / (WALKSPEEDVALUE / 2))), RAD(0), RAD(-5 * SIN(SINE / (WALKSPEEDVALUE / 2)))), 0.15 / Animation_Speed)
  858. RightShoulder.C0 = Clerp(RightShoulder.C0, CF(1.5, 0.5, -0.2) * ANGLES(RAD(0), RAD(0), RAD(0)) * ANGLES(RAD(35+60 * COS(SINE / WALKSPEEDVALUE)), RAD(0), RAD(5)) * RIGHTSHOULDERC0,1/Animation_Speed)
  859. LeftShoulder.C0 = Clerp(LeftShoulder.C0, CF(-1.5, 0.5, -0.2) * ANGLES(RAD(0), RAD(0), RAD(0)) * ANGLES(RAD(35-60 * COS(SINE / WALKSPEEDVALUE)), RAD(0), RAD(-5)) * LEFTSHOULDERC0, 1 / Animation_Speed)
  860. RightHip.C0 = Clerp(RightHip.C0, CF(1 , -1, 0) * ANGLES(RAD(0), RAD(90), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(5)), 2 / Animation_Speed)
  861. LeftHip.C0 = Clerp(LeftHip.C0, CF(-1, -1, 0) * ANGLES(RAD(0), RAD(-90), RAD(0)) * ANGLES(RAD(0), RAD(0), RAD(-5)), 2 / Animation_Speed)
  862. end
  863. end
  864. end
  865. unanchor()
  866. if Rooted == false then
  867. Disable_Jump = false
  868. Humanoid.WalkSpeed = Speed
  869. elseif Rooted == true then
  870. Disable_Jump = true
  871. Humanoid.WalkSpeed = 0
  872. end
  873. Character.Head.face.Texture = "rbxassetid://104824599"
  874. Humanoid.Health = Humanoid.Health + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement