Advertisement
therainbowcreeperRBX

Ragdoll fe

Oct 26th, 2019
4,887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.97 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. --By Rufus14 (FINALLY I KNOW HOW TO MAKE A RAGDOLL :D)
  88. --PRESS "R" TO RAGDOLLIFY
  89. using = false
  90. ragdolling = false
  91. hit = Instance.new("Sound", owner)
  92. hit.SoundId = "rbxassetid://12222152"
  93. hit.Volume = 5
  94. hit1 = Instance.new("Sound", owner)
  95. hit1.SoundId = "rbxassetid://12222152"
  96. hit1.Volume = 5
  97. hit2 = Instance.new("Sound", owner)
  98. hit2.SoundId = "rbxassetid://12222152"
  99. hit2.Volume = 5
  100. hit3 = Instance.new("Sound", owner)
  101. hit3.SoundId = "rbxassetid://12222152"
  102. hit3.Volume = 5
  103. hit3.TimePosition = 0.33
  104. print("Press R to ragdollify")
  105. function respawn(key)
  106. key = key:lower()
  107. if key == "t" then
  108. if ragdolling then
  109. ragdolling = false
  110. lshclone.Parent = owner
  111. glue:destroy()
  112. rshclone.Parent = owner
  113. glue1:destroy()
  114. lhclone.Parent = owner
  115. glue11:destroy()
  116. rhclone.Parent = owner
  117. glue111:destroy()
  118. collider:destroy()
  119. collider1:destroy()
  120. collider11:destroy()
  121. collider111:destroy()
  122. sensoring:destroy()
  123. sensoring1:destroy()
  124. owner.SpotLight:destroy()
  125. owner.Humanoid.PlatformStand = false
  126. end
  127. end
  128. end
  129. mouse.KeyDown:connect(respawn)
  130. function ragdoll(key)
  131. key = key:lower()
  132. if key == "r" then
  133. if not ragdolling then
  134. ragdolling = true
  135. local light = Instance.new("SpotLight", owner)
  136. owner.Humanoid.PlatformStand = true
  137. lshclone = owner["Left Shoulder"]:Clone()
  138. rshclone = owner["Right Shoulder"]:Clone()
  139. lhclone = owner["Left Hip"]:Clone()
  140. rhclone = owner["Right Hip"]:Clone()
  141. local leftarm =
  142. local rightrm = owner
  143. local leftleg = owner
  144. local rightleg = owner
  145. owner["Left Hip"]:destroy()
  146. local head = owner
  147. glue = Instance.new("Glue", owner)
  148. glue.Part0 = owner
  149. glue.Part1 = leftleg
  150. glue.Name = "Left leg"
  151. collider = Instance.new("Part", leftleg)
  152. collider.Position = Vector3.new(0,999,0)
  153. collider.Size = Vector3.new(1.5, 1, 1)
  154. collider.Shape = "Cylinder"
  155. local weld = Instance.new("Weld", collider)
  156. weld.Part0 = leftleg
  157. weld.Part1 = collider
  158. weld.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  159. collider.TopSurface = "Smooth"
  160. collider.BottomSurface = "Smooth"
  161. collider.formFactor = "Symmetric"
  162. glue.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  163. glue.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  164. collider.Transparency = 1
  165. ------------
  166. owner["Right Hip"]:destroy()
  167. glue1 = Instance.new("Glue", owner)
  168. glue1.Part0 = owner
  169. glue1.Part1 = rightleg
  170. glue1.Name = "Right leg"
  171. collider1 = Instance.new("Part", rightleg)
  172. collider1.Position = Vector3.new(0,9999,0)
  173. collider1.Size = Vector3.new(1.5, 1, 1)
  174. collider1.Shape = "Cylinder"
  175. local weld1 = Instance.new("Weld", collider1)
  176. weld1.Part0 = rightleg
  177. weld1.Part1 = collider1
  178. weld1.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  179. collider1.TopSurface = "Smooth"
  180. collider1.BottomSurface = "Smooth"
  181. collider1.formFactor = "Symmetric"
  182. glue1.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  183. glue1.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  184. collider1.Transparency = 1
  185. ------------
  186. owner["Right Shoulder"]:destroy()
  187. glue11 = Instance.new("Glue", owner)
  188. glue11.Part0 = owner
  189. glue11.Part1 = rightrm
  190. glue11.Name = "Right shoulder"
  191. collider11 = Instance.new("Part", rightrm)
  192. collider11.Position = Vector3.new(0,9999,0)
  193. collider11.Size = Vector3.new(1.8,1,1)
  194. collider11.Shape = "Cylinder"
  195. local weld11 = Instance.new("Weld", collider11)
  196. weld11.Part0 = rightrm
  197. weld11.Part1 = collider11
  198. weld11.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  199. collider11.TopSurface = "Smooth"
  200. collider11.BottomSurface = "Smooth"
  201. collider11.formFactor = "Symmetric"
  202. glue11.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  203. glue11.C1 = CFrame.new(0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  204. collider11.Transparency = 1
  205. ------------
  206. owner["Left Shoulder"]:destroy()
  207. glue111 = Instance.new("Glue", owner)
  208. glue111.Part0 = owner
  209. glue111.Part1 = leftarm
  210. glue111.Name = "Left shoulder"
  211. collider111 = Instance.new("Part", leftarm)
  212. collider111.Position = Vector3.new(0,9999,0)
  213. collider111.Size = Vector3.new(1.5, 1, 1)
  214. collider111.Shape = "Cylinder"
  215. local weld111 = Instance.new("Weld", collider111)
  216. weld111.Part0 = leftarm
  217. weld111.Part1 = collider111
  218. weld111.C0 = CFrame.new(0,-0.2,0) * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/2)
  219. collider111.TopSurface = "Smooth"
  220. collider111.BottomSurface = "Smooth"
  221. collider111.formFactor = "Symmetric"
  222. glue111.C0 = CFrame.new(-1.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  223. glue111.C1 = CFrame.new(0, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  224. collider111.Transparency = 1
  225. -----------------
  226. sensoring = Instance.new("Part", owner)
  227. sensoring.Size = Vector3.new(1.2,1.1,0.8)
  228. sensoring.CanCollide = false
  229. sensoring.Position = owner.Position
  230. local welder = Instance.new("Weld", sensoring)
  231. welder.Part0 = owner
  232. welder.Part1 = sensoring
  233. welder.C0 = welder.C0 * CFrame.new(0,0,1.05)
  234. sensoring.Transparency = 1
  235. -----------------
  236. sensoring1 = Instance.new("Part", owner)
  237. sensoring1.Size = Vector3.new(1.2,1.1,0.8)
  238. sensoring1.CanCollide = false
  239. sensoring1.Position = owner.Position
  240. local welder1 = Instance.new("Weld", sensoring)
  241. welder1.Part0 = owner
  242. welder1.Part1 = sensoring1
  243. welder1.C0 = welder1.C0 * CFrame.new(0,0,-1.05)
  244. sensoring1.Transparency = 1
  245. local function touch()
  246. if not using then
  247. using = true
  248. local Math = math.random(1,4)
  249. if Math == 1 then
  250. hit:Play()
  251. end
  252. if Math == 2 then
  253. hit1:Play()
  254. end
  255. if Math == 3 then
  256. hit2:Play()
  257. end
  258. if Math == 4 then
  259. hit3:Play()
  260. end
  261. wait(0.1)
  262. using = false
  263. end
  264. end
  265. sensoring.Touched:connect(touch)
  266. sensoring1.Touched:connect(touch)
  267. end
  268.  
  269. end
  270. end
  271. mouse.KeyDown:connect(ragdoll)
  272. --di ent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement