Advertisement
yoyo74456

RagDoll

Sep 6th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.77 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end
  2. InternalData = {}
  3. do
  4. script.Parent = owner.Character
  5. local Event = Instance.new("RemoteEvent")
  6. Event.Name = "UserInput"
  7. local function NewFakeEvent()
  8. local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func end}Fake.connect = Fake.Connect
  9. return Fake
  10. end
  11. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  12. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  13. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  14. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  15. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  16. local function TriggerEvent(self,Event,...)
  17. local Trigger = Mouse[Event]
  18. if Trigger and Trigger.fakeEvent and Trigger.Function then
  19. Trigger.Function(...)
  20. end
  21. end
  22. Mouse.TrigEvent = TriggerEvent
  23. UserInputService.TrigEvent = TriggerEvent
  24. Event.OnServerEvent:Connect(function(FiredBy,Input)
  25. if FiredBy.Name ~= owner.Name then end
  26. if Input.MouseEvent then
  27. Mouse.Target = Input.Target
  28. Mouse.Hit = Input.Hit
  29. else
  30. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  31. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  32. return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up")
  33. end
  34. for _,Action in pairs(ContextActionService.Actions) do
  35. for _,Key in pairs(Action.Keys) do
  36. if Key==Input.KeyCode then
  37. Action.Function(Action.Name,Input.UserInputState,Input)
  38. end
  39. end
  40. end
  41. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  42. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  43. end
  44. end)
  45. InternalData["Mouse"] = Mouse
  46. InternalData["ContextActionService"] = ContextActionService
  47. InternalData["UserInputService"] = UserInputService
  48. Event.Parent = NLS([[
  49. local Player = owner
  50. local Event = script:WaitForChild("UserInput")
  51. local UserInputService = game:GetService("UserInputService")
  52. local Mouse = Player:GetMouse()
  53. local Input = function(Input,gameProcessedEvent)
  54. if gameProcessedEvent then return end
  55. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  56. end
  57. UserInputService.InputBegan:Connect(Input)
  58. UserInputService.InputEnded:Connect(Input)
  59. local Hit,Target
  60. while wait(1/30) do
  61. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  62. Hit,Target = Mouse.Hit,Mouse.Target
  63. Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  64. end
  65. end
  66. ]],owner.Character)
  67. end
  68. RealGame = game;game = setmetatable({},{
  69. __index = function (self,Index)
  70. local Sandbox = function (Thing)
  71. if Thing:IsA("Player") then
  72. local RealPlayer = Thing
  73. return setmetatable({},{
  74. __index = function (self,Index)
  75. local Type = type(RealPlayer[Index])
  76. if Type == "function" then
  77. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  78. return function (self)
  79. return InternalData["Mouse"]
  80. end
  81. end
  82. return function (self,...)
  83. return RealPlayer[Index](RealPlayer,...)
  84. end
  85. else
  86. if Index == "PlrObj" then
  87. return RealPlayer
  88. end
  89. return RealPlayer[Index]
  90. end
  91. end;
  92. __tostring = function(self)
  93. return RealPlayer.Name
  94. end
  95. })
  96. end
  97. end
  98. if RealGame[Index] then
  99. local Type = type(RealGame[Index])
  100. if Type == "function" then
  101. if Index:lower() == "getservice" or Index:lower() == "service" then
  102. return function (self,Service)
  103. if Service:lower() == "players" then
  104. return setmetatable({},{
  105. __index = function (self2,Index2)
  106. local RealService = RealGame:GetService(Service)
  107. local Type2 = type(Index2)
  108. if Type2 == "function" then
  109. return function (self,...)
  110. return RealService[Index2](RealService,...)
  111. end
  112. else
  113. if Index2:lower() == "localplayer" then
  114. return Sandbox(owner)
  115. end
  116. return RealService[Index2]
  117. end
  118. end;
  119. __tostring = function(self)
  120. return RealGame:GetService(Service).Name
  121. end
  122. })
  123. elseif Service:lower() == "contextactionservice" then
  124. return InternalData["ContextActionService"]
  125. elseif Service:lower() == "contextactionservice" then
  126. return InternalData["UserInputService"]
  127. elseif Service:lower() == "runservice" then
  128. return setmetatable({},{
  129. __index = function(self2,Index2)
  130. local RealService = RealGame:GetService(Service)
  131. local Type2 = type(Index2)
  132. if Type2 == "function" then
  133. return function (self,...)
  134. return RealService[Index2](RealService,...)
  135. end
  136. else
  137. if Index2:lower() == "bindtorenderstep" then
  138. return function (self,Name,Priority,Function)
  139. return RealGame:GetService("RunService").Stepped:Connect(Function)
  140. end
  141. end
  142. if Index2:lower() == "renderstepped" then
  143. return RealService["Stepped"]
  144. end
  145. return RealService[Index2]
  146. end
  147. end
  148. })
  149. else
  150. return RealGame:GetService(Service)
  151. end
  152. end
  153. end
  154. return function (self,...)
  155. return RealGame[Index](RealGame,...)
  156. end
  157. else
  158. if game:GetService(Index) then
  159. return game:GetService(Index)
  160. end
  161. return RealGame[Index]
  162. end
  163. else
  164. return nil
  165. end
  166. end
  167. });Game = game;owner = game:GetService("Players").LocalPlayer;script = {}
  168. print("Complete! Running...")
  169.  
  170. --[[
  171. local vel = Instance.new("BodyVelocity", game.Players.LocalPlayer.Character.Torso)
  172. vel.Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * -5
  173. vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  174. --]]
  175. --Credit To Rufus14
  176. --I just edit it a bit ^_^
  177. mouse = game.Players.LocalPlayer:GetMouse()
  178. function ragdoll()
  179. game.Players.LocalPlayer.Character.Archivable = true
  180. clone = game.Players.LocalPlayer.Character:Clone()
  181. clone.Parent = workspace
  182. for i,v in pairs(clone:GetChildren()) do
  183. if v.ClassName == "Script" or v.ClassName == "LocalScript" then
  184. v:destroy()
  185. end
  186. for i,p in pairs(v:GetChildren()) do
  187. if p.ClassName == "Weld" or p.ClassName == "Motor6D" or p.ClassName == "BodyVelocity" then
  188. p:destroy()
  189. end
  190. end
  191. end
  192. for i,t in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
  193. if t.ClassName == "Accessory" or t.ClassName == "ForceField" then
  194. t:destroy()
  195. end
  196. end
  197. vel = Instance.new("BodyVelocity", clone.Torso)
  198. vel.Velocity = clone.Torso.CFrame.lookVector * -5
  199. vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  200. clone.Head.face.Texture = "http://www.roblox.com/asset/?id=161061608"
  201. using = false
  202. hit = Instance.new("Sound", clone.Torso)
  203. hit.SoundId = "rbxassetid://260430060"
  204. hit.Volume = 5
  205. hit1 = Instance.new("Sound", clone.Torso)
  206. hit1.SoundId = "rbxassetid://138087186"
  207. hit1.Volume = 5
  208. hit2 = Instance.new("Sound", clone.Torso)
  209. hit2.SoundId = "rbxassetid://131237241"
  210. hit2.Volume = 5
  211. hit3 = Instance.new("Sound", clone.Torso)
  212. hit3.SoundId = "rbxassetid://278062209"
  213. hit3.Volume = 5
  214. hit3.TimePosition = 0.33
  215. ded = Instance.new("Sound", clone.Torso)
  216. ded.SoundId = "rbxassetid://163154423"
  217. ded.Volume = 5
  218. local leftarm = clone:findFirstChild("Left Arm")
  219. local rightrm = clone:findFirstChild("Right Arm")
  220. local leftleg = clone:findFirstChild("Left Leg")
  221. local rightleg = clone:findFirstChild("Right Leg")
  222. local head = clone:findFirstChild("Head")
  223. local welding = Instance.new("Weld", clone.Torso)
  224. welding.Part0 = clone.Torso
  225. welding.Part1 = head
  226. welding.C0 = welding.C0 * CFrame.new(0,1.5,0)
  227. for i, g in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
  228. if g.ClassName == "Part" then
  229. g:destroy()
  230. end
  231. end
  232. for i, h in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
  233. if h.ClassName == "Accesory" then
  234. h:destroy()
  235. end
  236. end
  237. game.Workspace.CurrentCamera.CameraSubject = head
  238. if leftleg ~= nil then
  239. local glue = Instance.new("Glue", clone.Torso)
  240. glue.Part0 = clone.Torso
  241. glue.Part1 = leftleg
  242. glue.Name = "Left leg"
  243. local collider = Instance.new("Part", leftleg)
  244. collider.Position = Vector3.new(0,999,0)
  245. collider.Size = Vector3.new(1.7, 1, 1)
  246. collider.Shape = "Cylinder"
  247. local weld = Instance.new("Weld", collider)
  248. weld.Part0 = leftleg
  249. weld.Part1 = collider
  250. weld.C0 = CFrame.Angles(0, 0, 80)
  251. collider.TopSurface = "Smooth"
  252. collider.BottomSurface = "Smooth"
  253. collider.formFactor = "Symmetric"
  254. glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  255. glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  256. collider.Transparency = 1
  257. end
  258. ------------
  259. if rightleg ~= nil then
  260. local glue1 = Instance.new("Glue", clone.Torso)
  261. glue1.Part0 = clone.Torso
  262. glue1.Part1 = rightleg
  263. glue1.Name = "Right leg"
  264. local collider1 = Instance.new("Part", rightleg)
  265. collider1.Position = Vector3.new(0,999,0)
  266. collider1.Size = Vector3.new(1.7, 1, 1)
  267. collider1.Shape = "Cylinder"
  268. local weld1 = Instance.new("Weld", collider1)
  269. weld1.Part0 = rightleg
  270. weld1.Part1 = collider1
  271. weld1.C0 = CFrame.Angles(0, 0, 80)
  272. collider1.TopSurface = "Smooth"
  273. collider1.BottomSurface = "Smooth"
  274. collider1.formFactor = "Symmetric"
  275. glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  276. glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  277. collider1.Transparency = 1
  278. end
  279. ------------
  280. if rightrm ~= nil then
  281. local glue11 = Instance.new("Glue", clone.Torso)
  282. glue11.Part0 = clone.Torso
  283. glue11.Part1 = rightrm
  284. glue11.Name = "Right shoulder"
  285. local collider11 = Instance.new("Part", rightrm)
  286. collider11.Position = Vector3.new(0,9999,0)
  287. collider11.Size = Vector3.new(1.8,1,1)
  288. collider11.Shape = "Cylinder"
  289. local weld11 = Instance.new("Weld", collider11)
  290. weld11.Part0 = rightrm
  291. weld11.Part1 = collider11
  292. weld11.C0 = CFrame.Angles(0, 0, 80)
  293. collider11.TopSurface = "Smooth"
  294. collider11.BottomSurface = "Smooth"
  295. collider11.formFactor = "Symmetric"
  296. glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  297. glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  298. collider11.Transparency = 1
  299. end
  300. ------------
  301. if leftarm ~= nil then
  302. local glue111 = Instance.new("Glue", clone.Torso)
  303. glue111.Part0 = clone.Torso
  304. glue111.Part1 = leftarm
  305. glue111.Name = "Left shoulder"
  306. local collider111 = Instance.new("Part", leftarm)
  307. collider111.Position = Vector3.new(0,9999,0)
  308. collider111.Size = Vector3.new(1.8,1,1)
  309. collider111.Shape = "Cylinder"
  310. local weld111 = Instance.new("Weld", collider111)
  311. weld111.Part0 = leftarm
  312. weld111.Part1 = collider111
  313. weld111.C0 = CFrame.Angles(0, 0, 80)
  314. collider111.TopSurface = "Smooth"
  315. collider111.BottomSurface = "Smooth"
  316. collider111.formFactor = "Symmetric"
  317. glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  318. glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  319. collider111.Transparency = 1
  320. ----------------
  321. sensoring = Instance.new("Part", clone.Torso)
  322. sensoring.Size = Vector3.new(1.2,1.1,0.8)
  323. sensoring.CanCollide = false
  324. sensoring.Position = clone.Torso.Position
  325. local welder = Instance.new("Weld", sensoring)
  326. welder.Part0 = clone.Torso
  327. welder.Part1 = sensoring
  328. welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
  329. sensoring.Transparency = 1
  330. -----------------
  331. sensoring1 = Instance.new("Part", clone.Torso)
  332. sensoring1.Size = Vector3.new(1.2,1.1,0.8)
  333. sensoring1.CanCollide = false
  334. sensoring1.Position = clone.Torso.Position
  335. local welder1 = Instance.new("Weld", sensoring)
  336. welder1.Part0 = clone.Torso
  337. welder1.Part1 = sensoring1
  338. welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
  339. sensoring1.Transparency = 1
  340. end
  341. clone.Name = game.Players.LocalPlayer.Character.Name.." (DEAD)"
  342. ded:Play()
  343. vel:destroy()
  344. wait(0.5)
  345. local function touch()
  346. if not using then
  347. using = true
  348. local Math = math.random(1,4)
  349. if Math == 1 then
  350. hit:Play()
  351. end
  352. if Math == 2 then
  353. hit1:Play()
  354. end
  355. if Math == 3 then
  356. hit2:Play()
  357. end
  358. if Math == 4 then
  359. hit3:Play()
  360. end
  361. wait(0.1)
  362. using = false
  363. end
  364. end
  365. sensoring.Touched:connect(touch)
  366. sensoring1.Touched:connect(touch)
  367. wait(4.47)
  368. hit1.Volume = 0
  369. hit2.Volume = 0
  370. hit3.Volume = 0
  371. hit.Volume = 0
  372. end
  373.  
  374. game.Players.LocalPlayer.Character.Humanoid.Died:connect(ragdoll)
  375.  
  376. --di ent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement