DrakerMaker

ķ̸̪̝̊n̴̛̯̆͝i̸̯̦̰̫͛̋̏͂f̸̢̤̺̥̈̚ê̶̞̏͝͠ ̴̧̝̎͊

Dec 8th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.86 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. script.Parent = Player.Character
  5.  
  6. --RemoteEvent for communicating
  7. local Event = Instance.new("RemoteEvent")
  8. Event.Name = "UserInput_Event"
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local function fakeEvent()
  12. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  13. t.connect = t.Connect
  14. return t
  15. end
  16.  
  17. --Creating fake input objects with fake variables
  18. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  19. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  20. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  21. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  22. end}
  23. --Merged 2 functions into one by checking amount of arguments
  24. CAS.UnbindAction = CAS.BindAction
  25.  
  26. --This function will trigger the events that have been :Connect()'ed
  27. local function te(self,ev,...)
  28. local t = m[ev]
  29. if t and t._fakeEvent and t.Function then
  30. t.Function(...)
  31. end
  32. end
  33. m.TrigEvent = te
  34. UIS.TrigEvent = te
  35.  
  36. Event.OnServerEvent:Connect(function(plr,io)
  37. if plr~=Player then return end
  38. if io.isMouse then
  39. m.Target = io.Target
  40. m.Hit = io.Hit
  41. else
  42. local b = io.UserInputState == Enum.UserInputState.Begin
  43. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  44. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  45. end
  46. for _,t in pairs(CAS.Actions) do
  47. for _,k in pairs(t.Keys) do
  48. if k==io.KeyCode then
  49. t.Function(t.Name,io.UserInputState,io)
  50. end
  51. end
  52. end
  53. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  54. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  55. end
  56. end)
  57. Event.Parent = NLS([==[
  58. local Player = game:GetService("Players").LocalPlayer
  59. local Event = script:WaitForChild("UserInput_Event")
  60.  
  61. local UIS = game:GetService("UserInputService")
  62. local input = function(io,a)
  63. if a then return end
  64. --Since InputObject is a client-side instance, we create and pass table instead
  65. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  66. end
  67. UIS.InputBegan:Connect(input)
  68. UIS.InputEnded:Connect(input)
  69.  
  70. local Mouse = Player:GetMouse()
  71. local h,t
  72. --Give the server mouse data 30 times every second, but only if the values changed
  73. --If player is not moving their mouse, client won't fire events
  74. while wait(1/30) do
  75. if h~=Mouse.Hit or t~=Mouse.Target then
  76. h,t=Mouse.Hit,Mouse.Target
  77. Event:FireServer({isMouse=true,Target=t,Hit=h})
  78. end
  79. end]==],Player.Character)
  80. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  81. end
  82. local Handle = Instance.new("Part")
  83. local Mesh = Instance.new("SpecialMesh")
  84. local Part = Instance.new("Part")
  85. local Attachment = Instance.new("Attachment")
  86. local WeldConstraint = Instance.new("WeldConstraint")
  87. local Part_1 = Instance.new("Part")
  88. local Attachment_1 = Instance.new("Attachment")
  89. local WeldConstraint_1 = Instance.new("WeldConstraint")
  90. local Trail = Instance.new("Trail")
  91.  
  92. -- SETTING PROPERTIES
  93.  
  94. Handle.Anchored = false
  95. Handle.BottomSurface = Enum.SurfaceType.Smooth
  96. Handle.CFrame = CFrame.new(-19.933,1.4,74.334,1,0,-0.001,0,1,0.001,0.001,-0.001,1)
  97. Handle.Color = Color3.new(0.067,0.067,0.067)
  98. Handle.Material = Enum.Material.ForceField
  99. Handle.Size = Vector3.new(0.2,2.8,1)
  100. Handle.TopSurface = Enum.SurfaceType.Smooth
  101. Handle.Name = "Handle"
  102. Handle.Parent = owner.Character
  103.  
  104. Mesh.MeshType = Enum.MeshType.FileMesh
  105. Mesh.MeshId = "http://www.roblox.com/asset/?id=121944778 "
  106. Mesh.Parent = Handle
  107.  
  108. Part.BottomSurface = Enum.SurfaceType.Smooth
  109. Part.CFrame = CFrame.new(-19.932,0.055,74.333,1,0,-0.001,0,1,0.001,0.001,-0.001,1)
  110. Part.Size = Vector3.new(0.1,0.1,0.1)
  111. Part.TopSurface = Enum.SurfaceType.Smooth
  112. Part.Transparency = 1
  113. Part.Parent = Handle
  114.  
  115. Attachment.Parent = Part
  116.  
  117. WeldConstraint.Part0 = Part
  118. WeldConstraint.Part1 = Handle
  119. WeldConstraint.Parent = Part
  120.  
  121. Part_1.BottomSurface = Enum.SurfaceType.Smooth
  122. Part_1.CFrame = CFrame.new(-19.932,2.733,74.332,1,0,-0.001,0,1,0.001,0.001,-0.001,1)
  123. Part_1.Size = Vector3.new(0.1,0.1,0.1)
  124. Part_1.TopSurface = Enum.SurfaceType.Smooth
  125. Part_1.Transparency = 1
  126. Part_1.Parent = Handle
  127.  
  128. Attachment_1.Parent = Part_1
  129.  
  130. WeldConstraint_1.Part0 = Part_1
  131. WeldConstraint_1.Part1 = Handle
  132. WeldConstraint_1.Parent = Part_1
  133.  
  134. Trail.Attachment0 = Attachment
  135. Trail.Attachment1 = Attachment_1
  136. Trail.Color = ColorSequence.new(Color3.new(0,0,0))
  137. Trail.LightInfluence = 1
  138. Trail.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0,0),NumberSequenceKeypoint.new(1,1,0),NumberSequenceKeypoint.new(1,0,0)})
  139. Trail.Parent = Handle
  140. function wbtwe(Part0, Part1, C0)
  141. local weld = Instance.new("Weld", Part0)
  142. weld.Part0 = Part0
  143. weld.Part1 = Part1
  144. weld.C0 = Part1.CFrame:inverse() *Part1.CFrame *C0
  145. return weld
  146. end
  147. idle = 5
  148. walk = 5
  149. deb = false
  150. animt = true
  151. slash = false
  152. mode = 1
  153. hrw = wbtwe(owner.Character.Torso, owner.Character.HumanoidRootPart, CFrame.new(0, 0, 0) *CFrame.Angles(0, 0, 0))
  154. law = wbtwe(owner.Character["Left Arm"], owner.Character.Torso, CFrame.new(1.3, 1, 1) *CFrame.Angles(5.3, 25, 0))
  155. raw = wbtwe(owner.Character["Right Arm"], owner.Character.Torso, CFrame.new(-1.5, 0, 0) *CFrame.Angles(0, 0, -0.05))
  156. llw = wbtwe(owner.Character["Left Leg"], owner.Character.HumanoidRootPart, CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0.05))
  157. rlw = wbtwe(owner.Character["Right Leg"], owner.Character.HumanoidRootPart, CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, -0.05))
  158. hw = wbtwe(owner.Character.Head, owner.Character.Torso, CFrame.new(0, -1.5, 0) *CFrame.Angles(0, 0, 0))
  159. knw = wbtwe(Handle, owner.Character["Left Arm"], CFrame.new(-0.1, -0.3, 0.8) *CFrame.Angles(1, 0, 0))
  160. local stab = Instance.new("Sound", Handle)
  161. stab.SoundId = "rbxassetid://3533899133"
  162. stab.Volume = 3
  163. local song = Instance.new("Sound", owner.Character.Head)
  164. song.SoundId = "rbxassetid://1382488262"
  165. song.PlaybackSpeed = 0.2
  166. song.TimePosition = 3
  167. song.Looped = true
  168. song.Volume = 2
  169. song:Play()
  170. Instance.new("EchoSoundEffect", song)
  171. anim = coroutine.wrap(function()
  172. deb = true
  173. animt = false
  174. owner.Character.Humanoid.WalkSpeed = 2
  175. owner.Character.Humanoid.JumpPower = 0
  176. local laugh = Instance.new("Sound", owner.Character.Head)
  177. laugh.SoundId = "rbxassetid://1238240145"
  178. laugh.Volume = 3
  179. laugh:Play()
  180. for i = 1,105 do
  181. game:GetService("RunService").Stepped:wait()
  182. idle = idle +0.5
  183. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, math.sin(idle) *0.1, 0), 0.4)
  184. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0.3) *CFrame.Angles(-0.3, 0, 0), 0.4)
  185. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.3, 1, 1) *CFrame.Angles(5.3, 25, 0), 0.4)
  186. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.5, 0, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  187. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0.05), 0.4)
  188. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  189. end
  190. deb = false
  191. animt = true
  192. owner.Character.Humanoid.WalkSpeed = 16
  193. owner.Character.Humanoid.JumpPower = 50
  194. while game:GetService("RunService").Stepped:wait() do
  195. if animt == true then
  196. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0) *CFrame.Angles(math.rad(math.random(-3,3)), math.rad(math.random(-3,3)), math.rad(math.random(-3,3))), 1)
  197. if owner.Character.HumanoidRootPart.Velocity.Magnitude < 1 then
  198. idle = idle +0.1
  199. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, math.sin(idle) *0.2, 0), 0.4)
  200. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.3, 1, 1) *CFrame.Angles(5.3, 25, 0), 0.4)
  201. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.5, 0, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  202. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0.05), 0.4)
  203. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  204. end
  205. if owner.Character.HumanoidRootPart.Velocity.Magnitude > 1 then
  206. walk = walk + 0.2
  207. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, math.sin(walk) *0.2, 0), 0.4)
  208. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.3, 1, 1) *CFrame.Angles(5.3, 25, 0), 0.4)
  209. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.5, 0,math.cos(walk) *-0.2) *CFrame.Angles(math.cos(walk) *0.2, 0, -0.05), 0.4)
  210. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, math.cos(walk) *0.2) *CFrame.Angles(math.cos(walk) *-0.2, 25, 0.05), 0.4)
  211. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, math.cos(walk) *-0.2) *CFrame.Angles(math.cos(walk) *0.2, 0, -0.05), 0.4)
  212. end
  213. end
  214. end
  215. end)anim()
  216. mouse.KeyDown:connect(function(k)
  217. if k == "t" then
  218. if deb == false then
  219. deb = true
  220. animt = false
  221. owner.Character.Humanoid.WalkSpeed = 2
  222. owner.Character.Humanoid.JumpPower = 0
  223. local laugh = Instance.new("Sound", owner.Character.Head)
  224. laugh.SoundId = "rbxassetid://1238240145"
  225. laugh.Volume = 3
  226. laugh:Play()
  227. for i = 1,105 do
  228. game:GetService("RunService").Stepped:wait()
  229. idle = idle +0.5
  230. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, math.sin(idle) *0.1, 0), 0.4)
  231. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0.3) *CFrame.Angles(-0.3, 0, 0), 0.4)
  232. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.3, 1, 1) *CFrame.Angles(5.3, 25, 0), 0.4)
  233. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.5, 0, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  234. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0.05), 0.4)
  235. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  236. end
  237. deb = false
  238. animt = true
  239. owner.Character.Humanoid.WalkSpeed = 16
  240. owner.Character.Humanoid.JumpPower = 50
  241. end
  242. end
  243. end)
  244. mouse.Button1Down:connect(function()
  245. if deb == false then
  246. deb = true
  247. animt = false
  248. slash = true
  249. owner.Character.Humanoid.WalkSpeed = 2
  250. owner.Character.Humanoid.JumpPower = 0
  251. local swing = Instance.new("Sound", owner.Character.Head)
  252. swing.SoundId = "rbxassetid://1086616651"
  253. swing.Volume = 3
  254. swing:Play()
  255. for i = 1,25 do
  256. game:GetService("RunService").Stepped:wait()
  257. hrw.C0 = hrw.C0:lerp(owner.Character.HumanoidRootPart.CFrame:inverse() *owner.Character.HumanoidRootPart.CFrame *CFrame.new(0, 0, 0) *CFrame.Angles(0, 0.4, 0), 0.4)
  258. hw.C0 = hw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0, -1.5, 0) *CFrame.Angles(0, 0, 0), 0.4)
  259. law.C0 = law.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(1.5, 0, -1) *CFrame.Angles(5.3, 26, -5.3), 0.4)
  260. raw.C0 = raw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-1.5, 0, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  261. llw.C0 = llw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0.45, 2.1, 0) *CFrame.Angles(0, 25, 0.05), 0.4)
  262. rlw.C0 = rlw.C0:lerp(owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(-0.4, 2.1, 0) *CFrame.Angles(0, 0, -0.05), 0.4)
  263. end
  264. slash = false
  265. deb = false
  266. animt = true
  267. owner.Character.Humanoid.WalkSpeed = 16
  268. owner.Character.Humanoid.JumpPower = 50
  269. end
  270. end)
  271. Handle.Touched:connect(function(p)
  272. if slash == true then
  273. if p.Parent:FindFirstChild("Torso") then
  274. if p.Parent:FindFirstChildOfClass("Humanoid").Health > 0 then
  275. p.Parent:FindFirstChildOfClass("Humanoid").Health = 0
  276. stab:Play()
  277. Character=p.Parent
  278.  
  279. local leftarm = Character:FindFirstChild("Left Arm")
  280. local leftleg = Character:FindFirstChild("Left Leg")
  281. local rightleg = Character:FindFirstChild("Right Leg")
  282. local rightarm = Character:FindFirstChild("Right Arm")
  283. local torso = Character:FindFirstChild("Torso")
  284. local head = Character:FindFirstChild("Head")
  285. local root = Character:FindFirstChild("HumanoidRootPart")
  286.  
  287. local HeadA = Instance.new("Attachment")
  288. HeadA.Name = "HeadA"
  289. HeadA.Parent = head
  290. HeadA.Position = Vector3.new(0, -0.5, 0)
  291. HeadA.Rotation = Vector3.new(0, 0, -0)
  292. HeadA.Axis = Vector3.new(1, -0, -0)
  293. HeadA.SecondaryAxis = Vector3.new(0, 1, 0)
  294.  
  295. local LeftArmA = Instance.new("Attachment")
  296. LeftArmA.Name = "LeftArmA"
  297. LeftArmA.Parent = leftarm
  298. LeftArmA.Position = Vector3.new(0.4, 0.8, 0)
  299. LeftArmA.Rotation = Vector3.new(-180, 0, 90)
  300. LeftArmA.Axis = Vector3.new(0, -1, -0)
  301. LeftArmA.SecondaryAxis = Vector3.new(-1, 0, 0)
  302.  
  303. local LeftLegA = Instance.new("Attachment")
  304. LeftLegA.Name = "LeftLegA"
  305. LeftLegA.Parent = leftleg
  306. LeftLegA.Position = Vector3.new(0, 1, 0)
  307. LeftLegA.Rotation = Vector3.new(90, -90, 0)
  308. LeftLegA.Axis = Vector3.new(0, -1, -0)
  309. LeftLegA.SecondaryAxis = Vector3.new(0, -0, 1)
  310.  
  311. local RightArmA = Instance.new("Attachment")
  312. RightArmA.Name = "RightArmA"
  313. RightArmA.Parent = rightarm
  314. RightArmA.Position = Vector3.new(-0.4, 0.8, 0)--Vector3.new(0, 1, 0)
  315. RightArmA.Rotation = Vector3.new(-180, 0, 90)--Vector3.new(90, -90, 0)
  316. RightArmA.Axis = Vector3.new(0, -1, -0)--Vector3.new(0, -1, -0)
  317. RightArmA.SecondaryAxis = Vector3.new(0, 1, 0)--Vector3.new(0, -0, 1)
  318.  
  319. local RightLegA = Instance.new("Attachment")
  320. RightLegA.Name = "RightLegA"
  321. RightLegA.Parent = rightleg
  322. RightLegA.Position = Vector3.new(0, 1, 0) --Vector3.new(-0.4, 0.8, 0)
  323. RightLegA.Rotation = Vector3.new(90, -90, 0)--Vector3.new(-180, 0, 90)
  324. RightLegA.Axis = Vector3.new(0, -1, -0)--Vector3.new(0, -1, -0)
  325. RightLegA.SecondaryAxis = Vector3.new(0, -0, 1)--Vector3.new(0, 1, 0)
  326.  
  327. local TorsoA = Instance.new("Attachment")
  328. TorsoA.Name = "TorsoA"
  329. TorsoA.Parent = torso
  330. TorsoA.Position = Vector3.new(0.5, -1.1, 0)
  331. TorsoA.Rotation = Vector3.new(90, -90, 0)
  332. TorsoA.Axis = Vector3.new(0, -1, -0)
  333. TorsoA.SecondaryAxis = Vector3.new(0, -0, 1)
  334.  
  335. local TorsoA1 = Instance.new("Attachment")
  336. TorsoA1.Name = "TorsoA1"
  337. TorsoA1.Parent = torso
  338. TorsoA1.Position = Vector3.new(-0.5, -1.1, 0)
  339. TorsoA1.Rotation = Vector3.new(90, -90, 0)
  340. TorsoA1.Axis = Vector3.new(0, -1, -0)
  341. TorsoA1.SecondaryAxis = Vector3.new(0, -0, 1)
  342.  
  343. local TorsoA2 = Instance.new("Attachment")
  344. TorsoA2.Name = "TorsoA2"
  345. TorsoA2.Parent = torso
  346. TorsoA2.Position = Vector3.new(-1, 0.8, 0)
  347. TorsoA2.Rotation = Vector3.new(0, 0, -180)
  348. TorsoA2.Axis = Vector3.new(-1, -0, 0)
  349. TorsoA2.SecondaryAxis = Vector3.new(0, -1, 0)
  350.  
  351. local TorsoA3 = Instance.new("Attachment")
  352. TorsoA3.Name = "TorsoA3"
  353. TorsoA3.Parent = torso
  354. TorsoA3.Position = Vector3.new(1, 0.8, 0)
  355. TorsoA3.Rotation = Vector3.new(-180, 0, 0)
  356. TorsoA3.Axis = Vector3.new(1, -0, 0)
  357. TorsoA3.SecondaryAxis = Vector3.new(-0, -1, -0)
  358.  
  359. local TorsoA4 = Instance.new("Attachment")
  360. TorsoA4.Name = "TorsoA4"
  361. TorsoA4.Parent = torso
  362. TorsoA4.Position = Vector3.new(0, 1, 0)
  363. TorsoA4.Rotation = Vector3.new(0, 0, -0)
  364. TorsoA4.Axis = Vector3.new(1, -0, 0)
  365. TorsoA4.SecondaryAxis = Vector3.new(0, 1, 0)
  366.  
  367. local TorsoA5 = Instance.new("Attachment")
  368. TorsoA5.Name = "TorsoA5"
  369. TorsoA5.Parent = torso
  370. TorsoA5.Position = Vector3.new(0, 0, 0)
  371. TorsoA5.Rotation = Vector3.new(0, 90, 0)
  372. TorsoA5.Axis = Vector3.new(0, 0, -1)
  373. TorsoA5.SecondaryAxis = Vector3.new(0, 1, 0)
  374.  
  375. local TorsoA6 = Instance.new("Attachment")
  376. TorsoA6.Name = "TorsoA6"
  377. TorsoA6.Parent = torso
  378. TorsoA6.Position = Vector3.new(0, 1, 0)
  379. TorsoA5.Rotation = Vector3.new(0, 0, 0)
  380. --TorsoA6.Axis = Vector3.new(0, 0, -1)
  381. --TorsoA6.SecondaryAxis = Vector3.new(0, 1, 0)
  382.  
  383.  
  384. local rootA = Instance.new("Attachment")
  385. rootA.Name= "rootA"
  386. rootA.Parent = root
  387. rootA.Position = Vector3.new(0, 0, 0)
  388. rootA.Rotation = Vector3.new(0, 90, 0)
  389. rootA.Axis = Vector3.new(0, 0, -1)
  390. rootA.SecondaryAxis = Vector3.new(0, 1, 0)
  391.  
  392.  
  393. local LAT = Instance.new("BallSocketConstraint")
  394. LAT.Parent = leftarm
  395. LAT.Attachment0 = LeftArmA
  396. LAT.Attachment1 = TorsoA2
  397. LAT.Enabled = true
  398.  
  399. local RAT = Instance.new("BallSocketConstraint")
  400. RAT.Parent = rightarm
  401. RAT.Attachment0 = RightArmA
  402. RAT.Attachment1 = TorsoA3
  403. RAT.Enabled = true
  404.  
  405. local TLL = Instance.new("BallSocketConstraint")
  406. TLL.Parent = torso
  407. TLL.Attachment0 = TorsoA1
  408. TLL.Attachment1 = LeftLegA
  409. TLL.Enabled = true
  410.  
  411. local TRL = Instance.new("BallSocketConstraint")
  412. TRL.Parent = torso
  413. TRL.Attachment0 = TorsoA
  414. TRL.Attachment1 = RightLegA
  415. TRL.Enabled = true
  416.  
  417. local RTA = Instance.new("BallSocketConstraint")
  418. RTA.Parent = root
  419. RTA.Attachment0 = rootA
  420. RTA.Attachment1 = TorsoA5
  421. RTA.Enabled = true
  422.  
  423. local Neck = Instance.new("BallSocketConstraint")
  424. Neck.Parent = torso
  425. Neck.Attachment0 = TorsoA6
  426. Neck.Attachment1 = HeadA
  427. Neck.Enabled = true
  428.  
  429. function getAttachment0(attachmentName)
  430. for _,child in next,Character:GetChildren() do
  431. local attachment = child:FindFirstChild(attachmentName)
  432. if attachment then
  433. return attachment
  434. end
  435. end
  436. end
  437.  
  438.  
  439. for _,child in next,Character:GetChildren() do
  440. if child:IsA("Accoutrement") then
  441. --Loop through all parts instead of only checking for one to be forwards-compatible in the event
  442. --ROBLOX implements multi-part accessories
  443. for _,part in next,child:GetChildren() do
  444. if part:IsA("BasePart") then
  445. local attachment1 = part:FindFirstChildOfClass("Attachment")
  446. local attachment0 = getAttachment0(attachment1.Name)
  447. if attachment0 and attachment1 then
  448. --Shouldn't use constraints for this, but have to because of a ROBLOX idiosyncrasy where
  449. --joints connecting a character are perpetually deleted while the character is dead
  450. local constraint = Instance.new("HingeConstraint")
  451. constraint.Attachment0 = attachment0
  452. constraint.Attachment1 = attachment1
  453. constraint.LimitsEnabled = true
  454. constraint.UpperAngle = 0 --Simulate weld by making it difficult for constraint to move
  455. constraint.LowerAngle = 0
  456. constraint.Parent = Character
  457. end
  458. end
  459. end
  460. end
  461. end
  462. end
  463. end
  464. if p.Parent:FindFirstChild("UpperTorso") then
  465. if p.Parent:FindFirstChildOfClass("Humanoid").Health > 0 then
  466. p.Parent:FindFirstChildOfClass("Humanoid").Health = 0
  467. stab:Play()
  468. character=p.Parent
  469. function recurse(root,callback,i)
  470. i= i or 0
  471. for _,v in pairs(root:GetChildren()) do
  472. i = i + 1
  473. callback(i,v)
  474.  
  475. if #v:GetChildren() > 0 then
  476. i = recurse(v,callback,i)
  477. end
  478. end
  479.  
  480. return i
  481. end
  482.  
  483. function ragdollJoint(part0, part1, attachmentName, className, properties)
  484. attachmentName = attachmentName.."RigAttachment"
  485. local constraint = Instance.new(className.."Constraint")
  486. constraint.Attachment0 = part0:FindFirstChild(attachmentName)
  487. constraint.Attachment1 = part1:FindFirstChild(attachmentName)
  488. constraint.Name = "RagdollConstraint"..part1.Name
  489.  
  490. for _,propertyData in next,properties or {} do
  491. constraint[propertyData[1]] = propertyData[2]
  492. end
  493.  
  494. constraint.Parent = character
  495. end
  496.  
  497. function getAttachment0(attachmentName)
  498. for _,child in next,character:GetChildren() do
  499. local attachment = child:FindFirstChild(attachmentName)
  500. if attachment then
  501. return attachment
  502. end
  503. end
  504. end
  505.  
  506. --character:WaitForChild("Humanoid").Died:connect(function()
  507. local camera = workspace.CurrentCamera
  508. if camera.CameraSubject == character.Humanoid then--If developer isn't controlling camera
  509. camera.CameraSubject = character.UpperTorso
  510. end
  511.  
  512. --Make it so ragdoll can't collide with invisible HRP, but don't let HRP fall through map and be destroyed in process
  513. character.HumanoidRootPart.Anchored = true
  514. character.HumanoidRootPart.CanCollide = false
  515.  
  516. --Helps to fix constraint spasms
  517. recurse(character, function(_,v)
  518. if v:IsA("Attachment") then
  519. v.Axis = Vector3.new(0, 1, 0)
  520. v.SecondaryAxis = Vector3.new(0, 0, 1)
  521. v.Rotation = Vector3.new(0, 0, 0)
  522. end
  523. end)
  524.  
  525. --Re-attach hats
  526. for _,child in next,character:GetChildren() do
  527. if child:IsA("Accoutrement") then
  528. --Loop through all parts instead of only checking for one to be forwards-compatible in the event
  529. --ROBLOX implements multi-part accessories
  530. for _,part in next,child:GetChildren() do
  531. if part:IsA("BasePart") then
  532. local attachment1 = part:FindFirstChildOfClass("Attachment")
  533. local attachment0 = getAttachment0(attachment1.Name)
  534. if attachment0 and attachment1 then
  535. --Shouldn't use constraints for this, but have to because of a ROBLOX idiosyncrasy where
  536. --joints connecting a character are perpetually deleted while the character is dead
  537. local constraint = Instance.new("HingeConstraint")
  538. constraint.Attachment0 = attachment0
  539. constraint.Attachment1 = attachment1
  540. constraint.LimitsEnabled = true
  541. constraint.UpperAngle = 0 --Simulate weld by making it difficult for constraint to move
  542. constraint.LowerAngle = 0
  543. constraint.Parent = character
  544. end
  545. end
  546. end
  547. end
  548. end
  549.  
  550. ragdollJoint(character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
  551. {"LimitsEnabled",true};
  552. {"UpperAngle",5};
  553. })
  554. --[
  555. ragdollJoint(character.UpperTorso, character.Head, "Neck", "BallSocket", {
  556. {"LimitsEnabled",true};
  557. {"UpperAngle",15};
  558. })--]]
  559.  
  560. local handProperties = {
  561. {"LimitsEnabled", true};
  562. {"UpperAngle",0};
  563. {"LowerAngle",0};
  564. }
  565. ragdollJoint(character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
  566. ragdollJoint(character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)
  567.  
  568. local shinProperties = {
  569. {"LimitsEnabled", true};
  570. {"UpperAngle", 0};
  571. {"LowerAngle", -75};
  572. }
  573. ragdollJoint(character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
  574. ragdollJoint(character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)
  575.  
  576. local footProperties = {
  577. {"LimitsEnabled", true};
  578. {"UpperAngle", 15};
  579. {"LowerAngle", -45};
  580. }
  581. ragdollJoint(character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
  582. ragdollJoint(character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)
  583.  
  584. --TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped
  585. ragdollJoint(character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
  586. ragdollJoint(character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
  587. ragdollJoint(character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
  588. ragdollJoint(character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
  589. ragdollJoint(character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
  590. ragdollJoint(character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")
  591. --end)
  592. end
  593. end
  594. end
  595. end)
Add Comment
Please, Sign In to add comment