Advertisement
JacksoMykalJunior

ForceField [FE]

Mar 3rd, 2019
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.02 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 = owner
  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.  
  88. plr = owner
  89. repeat wait() until plr.Character
  90. char = plr.Character
  91.  
  92. -- Credit to shack for the anti death system
  93.  
  94. local BODY = {}
  95. LeftArm = char["Left Arm"]
  96. RightLeg = char["Right Leg"]
  97. LeftLeg = char["Left Leg"]
  98. for _, c in pairs(char:GetDescendants()) do
  99. if c:IsA("BasePart") and c.Name ~= "Handle" then
  100. if c ~= char.HumanoidRootPart and c ~= char.Torso and c ~= char.Head and c ~= char["Right Arm"] and c ~= LeftArm and c ~= RightLeg and c ~= LeftLeg then
  101. c.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
  102. end
  103. table.insert(BODY,{c,c.Parent,c.Material,c.Color,c.Transparency})
  104. elseif c:IsA("JointInstance") then
  105. table.insert(BODY,{c,c.Parent,nil,nil,nil})
  106. end
  107. end
  108. for e = 1, #BODY do
  109. if BODY[e] ~= nil then
  110. local STUFF = BODY[e]
  111. local PART = STUFF[1]
  112. local PARENT = STUFF[2]
  113. local MATERIAL = STUFF[3]
  114. local COLOR = STUFF[4]
  115. local TRANSPARENCY = STUFF[5]
  116. if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then
  117. PART.Material = MATERIAL
  118. PART.Color = COLOR
  119. PART.Transparency = TRANSPARENCY
  120. end
  121. PART.AncestryChanged:Connect(function()
  122. PART.Parent = PARENT
  123. end)
  124. end
  125. end
  126. function refit()
  127. char.Parent = workspace
  128. for e = 1, #BODY do
  129. if BODY[e] ~= nil then
  130. local STUFF = BODY[e]
  131. local PART = STUFF[1]
  132. local PARENT = STUFF[2]
  133. local MATERIAL = STUFF[3]
  134. local COLOR = STUFF[4]
  135. local TRANSPARENCY = STUFF[5]
  136. if PART.ClassName == "Part" and PART ~= char.HumanoidRootPart then
  137. PART.Material = MATERIAL
  138. PART.Color = COLOR
  139. PART.Transparency = TRANSPARENCY
  140. end
  141. if PART.Parent ~= PARENT then
  142. char:FindFirstChildOfClass("Humanoid"):remove()
  143. PART.Parent = PARENT
  144. Humanoid = Instance.new("Humanoid",char)
  145. end
  146. end
  147. end
  148. end
  149. char.Humanoid.Died:connect(function()
  150. refit()
  151. end)
  152. local torso = Instance.new("SelectionBox",char)
  153. torso.Adornee = char.Torso
  154. local leftarm = Instance.new("SelectionBox",char)
  155. leftarm.Adornee = LeftArm
  156. local rightarm = Instance.new("SelectionBox",char)
  157. rightarm.Adornee = char["Right Arm"]
  158. local leftleg = Instance.new("SelectionBox",char)
  159. leftleg.Adornee = LeftLeg
  160. local rightleg = Instance.new("SelectionBox",char)
  161. rightleg.Adornee = char["Right Leg"]
  162. -- Color pallet
  163. green = "Lime green"
  164. red = "Really red"
  165. blue = "Electric blue"
  166. yellow = "New Yeller"
  167. violet = "Pastel violet"
  168.  
  169. coroutine.wrap(function()
  170. while true do
  171. wait(0.5)
  172. torso.Color3 = BrickColor.new(green).Color
  173. rightarm.Color3 = BrickColor.new(green).Color
  174. leftarm.Color3 = BrickColor.new(green).Color
  175. leftleg.Color3 = BrickColor.new(green).Color
  176. rightleg.Color3 = BrickColor.new(green).Color
  177. wait(0.5)
  178. torso.Color3 = BrickColor.new(red).Color
  179. rightarm.Color3 = BrickColor.new(red).Color
  180. leftarm.Color3 = BrickColor.new(red).Color
  181. leftleg.Color3 = BrickColor.new(red).Color
  182. rightleg.Color3 = BrickColor.new(red).Color
  183. wait(0.5)
  184. torso.Color3 = BrickColor.new(blue).Color
  185. rightarm.Color3 = BrickColor.new(blue).Color
  186. leftarm.Color3 = BrickColor.new(blue).Color
  187. leftleg.Color3 = BrickColor.new(blue).Color
  188. rightleg.Color3 = BrickColor.new(blue).Color
  189. wait(0.5)
  190. torso.Color3 = BrickColor.new(yellow).Color
  191. rightarm.Color3 = BrickColor.new(yellow).Color
  192. leftarm.Color3 = BrickColor.new(yellow).Color
  193. leftleg.Color3 = BrickColor.new(yellow).Color
  194. rightleg.Color3 = BrickColor.new(yellow).Color
  195. wait(0.5)
  196. torso.Color3 = BrickColor.new(violet).Color
  197. rightarm.Color3 = BrickColor.new(violet).Color
  198. leftarm.Color3 = BrickColor.new(violet).Color
  199. leftleg.Color3 = BrickColor.new(violet).Color
  200. rightleg.Color3 = BrickColor.new(violet).Color
  201. end
  202. end)()
  203. while true do
  204. wait()
  205. refit()
  206. char.Humanoid.Health = math.huge
  207. char.Humanoid.MaxHealth = math.huge
  208. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement