Advertisement
DaRealDreamz193

ragdoll anti death

May 20th, 2019
1,668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.30 KB | None | 0 0
  1. -- https://www.youtube.com/watch?v=GCl19ixRbHg
  2. print("Decay removed because of glitches, sorry.")
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  5. do
  6. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  7. script.Parent = Player.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent and t.Function then
  33. t.Function(...)
  34. end
  35. end
  36. m.TrigEvent = te
  37. UIS.TrigEvent = te
  38.  
  39. Event.OnServerEvent:Connect(function(plr,io)
  40. if plr~=Player then return end
  41. if io.isMouse then
  42. m.Target = io.Target
  43. m.Hit = io.Hit
  44. else
  45. local b = io.UserInputState == Enum.UserInputState.Begin
  46. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  47. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  48. end
  49. for _,t in pairs(CAS.Actions) do
  50. for _,k in pairs(t.Keys) do
  51. if k==io.KeyCode then
  52. t.Function(t.Name,io.UserInputState,io)
  53. end
  54. end
  55. end
  56. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  57. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  58. end
  59. end)
  60. Event.Parent = NLS([==[
  61. local Player = game:GetService("Players").LocalPlayer
  62. local Event = script:WaitForChild("UserInput_Event")
  63.  
  64. local UIS = game:GetService("UserInputService")
  65. local input = function(io,a)
  66. if a then return end
  67. --Since InputObject is a client-side instance, we create and pass table instead
  68. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  69. end
  70. UIS.InputBegan:Connect(input)
  71. UIS.InputEnded:Connect(input)
  72.  
  73. local Mouse = Player:GetMouse()
  74. local h,t
  75. --Give the server mouse data 30 times every second, but only if the values changed
  76. --If player is not moving their mouse, client won't fire events
  77. while wait(1/30) do
  78. if h~=Mouse.Hit or t~=Mouse.Target then
  79. h,t=Mouse.Hit,Mouse.Target
  80. Event:FireServer({isMouse=true,Target=t,Hit=h})
  81. end
  82. end]==],Player.Character)
  83. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  84. end
  85. local CN = CFrame.new
  86. local Player_Size = 1
  87. local plr = owner
  88. local char = plr.Character
  89. local hum = char:FindFirstChildOfClass'Humanoid'
  90. local rarm = char["Right Arm"]
  91. local larm= char["Left Arm"]
  92. local rleg= char["Right Leg"]
  93. local lleg = char["Left Leg"]
  94. local root = char:FindFirstChild'HumanoidRootPart'
  95. local torso = char.Torso
  96. local head = char.Head
  97. script.Parent = char
  98. function WELD(type,parent,part0,part1,c0,c1)
  99. local WELD = Instance.new(type,parent)
  100. WELD.Part0 = part0
  101. WELD.Part1 = part1
  102. WELD.C0 = c0 or CN()
  103. WELD.C1 = c1 or CN()
  104. return WELD
  105. end
  106. local LS = WELD('Glue',torso,torso,larm,CN(-1.5 * Player_Size,0.5 * Player_Size,0),CN(0,.5 * Player_Size,0))
  107. local RS = WELD('Glue',torso,torso,rarm,CN(1.5 * Player_Size,0.5 * Player_Size,0),CN(0,.5 * Player_Size,0))
  108. local NK = WELD('Weld',torso,torso,head,CN(0,1.5,0))
  109. local LH = WELD('Glue',torso,torso,lleg,CN(-.5 * Player_Size,-1 * Player_Size,0),CN(0,1 * Player_Size,0))
  110. local RH = WELD('Glue',torso,torso,rleg,CN(.5 * Player_Size,-1 * Player_Size,0),CN(0,1 * Player_Size,0))
  111. local RJ = WELD('Glue',root,root,torso)
  112. local FF = Instance.new("ForceField",char)
  113. FF.Visible = false
  114. function refit()
  115. RJ.Parent = root
  116. NK.Parent = torso
  117. RS.Parent = torso
  118. LS.Parent = torso
  119. RH.Parent = torso
  120. LH.Parent = torso
  121. root.Parent = char
  122. larm.Parent = char
  123. rarm.Parent = char
  124. rleg.Parent = char
  125. lleg.Parent = char
  126. torso.Parent = char
  127. head.Parent = char
  128. end
  129. function ConnectHum()
  130. hum.Died:connect(function()
  131. hum:Destroy()
  132. refit()
  133. hum = Instance.new("Humanoid",char,{{"MaxHealth",1}})
  134. ConnectHum()
  135. end)
  136. end
  137. ConnectHum()
  138. while true do
  139. wait(2)
  140. change = script.Parent:WaitForChild("Humanoid")
  141. change.MaxHealth = 1
  142. change.Health = change.MaxHealth
  143. end
  144. hum.HealthChanged:Connect(function(newhealth)
  145. if newhealth < 1 then
  146. hum.MaxHealth = 1
  147. hum.Health = hum.MaxHealth
  148. end
  149. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement