Advertisement
EdgyHedgehog

Heavy FE

Sep 28th, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.74 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. print("FE Compatibility code by Mokiros")
  5. script.Parent = Player.Character
  6.  
  7. --RemoteEvent for communicating
  8. local Event = Instance.new("RemoteEvent")
  9. Event.Name = "UserInput_Event"
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local function fakeEvent()
  13. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  14. t.connect = t.Connect
  15. return t
  16. end
  17.  
  18. --Creating fake input objects with fake variables
  19. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  20. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  21. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  22. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  23. end}
  24. --Merged 2 functions into one by checking amount of arguments
  25. CAS.UnbindAction = CAS.BindAction
  26.  
  27. --This function will trigger the events that have been :Connect()'ed
  28. local function te(self,ev,...)
  29. local t = m[ev]
  30. if t and t._fakeEvent and t.Function then
  31. t.Function(...)
  32. end
  33. end
  34. m.TrigEvent = te
  35. UIS.TrigEvent = te
  36.  
  37. Event.OnServerEvent:Connect(function(plr,io)
  38. if plr~=Player then return end
  39. if io.isMouse then
  40. m.Target = io.Target
  41. m.Hit = io.Hit
  42. else
  43. local b = io.UserInputState == Enum.UserInputState.Begin
  44. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  45. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  46. end
  47. for _,t in pairs(CAS.Actions) do
  48. for _,k in pairs(t.Keys) do
  49. if k==io.KeyCode then
  50. t.Function(t.Name,io.UserInputState,io)
  51. end
  52. end
  53. end
  54. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  55. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  56. end
  57. end)
  58. Event.Parent = NLS([==[
  59. local Player = game:GetService("Players").LocalPlayer
  60. local Event = script:WaitForChild("UserInput_Event")
  61.  
  62. local UIS = game:GetService("UserInputService")
  63. local input = function(io,a)
  64. if a then return end
  65. --Since InputObject is a client-side instance, we create and pass table instead
  66. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  67. end
  68. UIS.InputBegan:Connect(input)
  69. UIS.InputEnded:Connect(input)
  70.  
  71. local Mouse = Player:GetMouse()
  72. local h,t
  73. --Give the server mouse data 30 times every second, but only if the values changed
  74. --If player is not moving their mouse, client won't fire events
  75. while wait(1/30) do
  76. if h~=Mouse.Hit or t~=Mouse.Target then
  77. h,t=Mouse.Hit,Mouse.Target
  78. Event:FireServer({isMouse=true,Target=t,Hit=h})
  79. end
  80. end]==],Player.Character)
  81. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  82. end
  83. local Player = owner
  84. local Character = Player.Character
  85. --Mouse.TargetFilter = workspace
  86.  
  87. local Head = Character:WaitForChild("Head")
  88. local Torso = Character:WaitForChild("Torso")
  89. local RootPart = Character:WaitForChild("HumanoidRootPart")
  90. local Human = Character:WaitForChild("Humanoid")
  91.  
  92. Human.AutoRotate = false
  93. Human.JumpPower = 0
  94. Human.WalkSpeed = 12
  95.  
  96. -----------------------------------------------------------------------------------------------------------------------
  97.  
  98. for _, Item in next, Character:GetChildren() do
  99. if Item:IsA("CharacterAppearance") then
  100. Item:Destroy()
  101. end
  102. end
  103.  
  104. local Pants = Character:FindFirstChild("Pants") or Instance.new("Pants")
  105. Pants.PantsTemplate = "rbxassetid://69232474"
  106. Pants.Name = "Pants"
  107. Pants.Parent = Character
  108.  
  109. local Shirt = Character:FindFirstChild("Shirt") or Instance.new("Shirt")
  110. Shirt.ShirtTemplate = "rbxassetid://69232183"
  111. Shirt.Name = "Shirt"
  112. Shirt.Parent = Character
  113.  
  114. local Face = Head:WaitForChild("face")
  115. Face.Texture = "rbxassetid://112805849"
  116.  
  117. local TShirt = Torso:FindFirstChild("roblox")
  118. if TShirt then
  119. TShirt:Destroy()
  120. end
  121.  
  122. --[[local BodyColors = Character:WaitForChild("Body Colors")
  123. BodyColors.HeadColor = BrickColor.new("Light orange")
  124. BodyColors.LeftArmColor = BrickColor.new("Light orange")
  125. BodyColors.RightArmColor = BrickColor.new("Light orange")
  126. BodyColors.TorsoColor = BrickColor.new("Light orange")--]]
  127.  
  128. spawn(function() wait(.5)
  129. Head.BrickColor = BrickColor.new("Light orange")
  130. Torso.BrickColor = BrickColor.new("Light orange")
  131. Character["Left Arm"].BrickColor = BrickColor.new("Light orange")
  132. Character["Right Arm"].BrickColor = BrickColor.new("Light orange")
  133. end)
  134.  
  135. Character:WaitForChild("Animate"):Destroy()
  136.  
  137. local RJ = RootPart:WaitForChild("RootJoint")
  138. RJ:Destroy()
  139. RJ = Instance.new("Weld", RootPart)
  140. RJ.Part0 = RootPart
  141. RJ.Part1 = Torso
  142.  
  143. local Neck = Instance.new("Weld", Torso)
  144. Neck.Part0 = Torso
  145. Neck.Part1 = Character:WaitForChild("Head")
  146. Neck.C0 = CFrame.new(0, 1.5, 0)
  147.  
  148. Torso:WaitForChild("Right Shoulder").Part1 = nil
  149. local RS = Instance.new("Weld", Head)
  150. RS.Part0 = Head
  151. RS.Part1 = Character:WaitForChild("Right Arm")
  152.  
  153. Torso:WaitForChild("Left Shoulder").Part1 = nil
  154. local LS = Instance.new("Weld", Head)
  155. LS.Part0 = Head
  156. LS.Part1 = Character:WaitForChild("Left Arm")
  157.  
  158. local LH = Torso:WaitForChild("Left Hip")
  159. LH:Destroy()
  160. LH = Instance.new("Weld", Torso)
  161. LH.Part0 = Torso
  162. LH.Part1 = Character:WaitForChild("Left Leg")
  163.  
  164. local RH = Torso:WaitForChild("Right Hip")
  165. RH:Destroy()
  166. RH = Instance.new("Weld", Torso)
  167. RH.Part0 = Torso
  168. RH.Part1 = Character:WaitForChild("Right Leg")
  169.  
  170. local GUN = Instance.new("Part", Character)
  171. GUN.CanCollide = false
  172. GUN.Size = Vector3.new(1.549, 2.302, 3.814)
  173. GUN.Name = "Handle"
  174. GUN.Material = Enum.Material.SmoothPlastic
  175.  
  176. local MS = Instance.new("SpecialMesh", GUN)
  177. MS.MeshType = Enum.MeshType.FileMesh
  178. MS.MeshId = "rbxassetid://450812185"
  179. MS.TextureId = "rbxassetid://450812194"
  180.  
  181. local GRIP = Instance.new("Weld", RS.Part1)
  182. GRIP.Part0 = RS.Part1
  183. GRIP.Part1 = GUN
  184.  
  185. local SN = Instance.new("Sound", GUN)
  186. SN.SoundId = "rbxassetid://341294387"
  187. SN.PlaybackSpeed = 0.9
  188. SN.Looped = true
  189. SN.Volume = 0
  190. SN:Play()
  191.  
  192. local FL = Instance.new("Part", GUN)
  193. FL.BrickColor = BrickColor.Yellow()
  194. FL.Transparency = 1
  195. FL.Material = Enum.Material.SmoothPlastic
  196. FL.CanCollide = false
  197. FL.Size = Vector3.new(1, 3.38, 1)
  198.  
  199. local MS2 = Instance.new("SpecialMesh", FL)
  200. MS2.MeshType = Enum.MeshType.FileMesh
  201. MS2.MeshId = "rbxassetid://1323306"
  202. MS2.Scale = Vector3.new(0.35, 1.9, 0.35)
  203.  
  204. local FLW = Instance.new("Weld", GUN)
  205. FLW.Part0 = GUN
  206. FLW.Part1 = FL
  207. FLW.C0 = CFrame.new(0.293, 0.251, 3.221, 0, 0.028, 1, 1, 0, 0, 0, 1, -0.028)
  208.  
  209. -----------------------------------------------------------------------------------------------------------------------
  210.  
  211. local STANCE = {
  212. NK = CFrame.new(0, 1, 0, 0.747311652, 0, 0.664473772, 0, 1, 0, -0.664473772, 0, 0.747311652);
  213. RJ = CFrame.new(0, 0, 0, 0.747311592, 0, -0.664473712, 0, 1, 0, 0.664473712, 0, 0.747311592);
  214. LS = CFrame.new(0.474761963, -1.61745477, -1.20455933, -0.127145067, -0.88503027, -0.447834671, -0.836402416, 0.338357687, -0.431213528, 0.533165276, 0.319743276, -0.783262014);
  215. RS = CFrame.new(1.14480591, -1.47239065, 0.695491791, 0.972185493, -0.190045089, -0.136889026, 0.123703048, 0.912935674, -0.388903707, 0.198880106, 0.361152887, 0.911051929);
  216. GRIP = CFrame.new(-0.0976009369, -1.92251587, -1.31733322, -0.980839312, 0.117544398, -0.155363142, 0.158846945, 0.944226265, -0.288452089, 0.11279203, -0.307604104, -0.944805682);
  217. }
  218.  
  219. LS.C0 = STANCE.LS
  220. RS.C0 = STANCE.RS
  221. RJ.C0 = STANCE.RJ
  222. GRIP.C0 = STANCE.GRIP
  223.  
  224. local Down = false
  225.  
  226. Mouse.Button1Down:Connect(function()
  227. Down = true
  228. end)
  229.  
  230. Mouse.Button1Up:Connect(function()
  231. Down = false
  232. end)
  233.  
  234. math.randomseed(os.time())
  235.  
  236. local function Taunt()
  237. local Taunts = {137542750, 130774824, 130776108, 679798995, 679798810}
  238. local Sound = Instance.new("Sound", GUN)
  239. local Id = Taunts[math.random(#Taunts)]
  240. Sound.TimePosition = Id == 130776108 and 4.2 or 0
  241. Sound.SoundId = "rbxassetid://" .. Id
  242. Sound.Volume = 1
  243. Sound.Ended:Connect(function()
  244. Sound:Destroy()
  245. end)
  246. Sound:Play()
  247. end
  248.  
  249. Mouse.KeyDown:Connect(function(Key)
  250. if Key == string.char(32) then
  251. Taunt()
  252. end
  253. end)
  254.  
  255.  
  256.  
  257. local function Shoot()
  258. local Bullet = Instance.new("Part")
  259. Bullet.Size = Vector3.new(0.3, 0.3, 0.7)
  260. Bullet.Transparency = 1
  261. Bullet.CanCollide = false
  262.  
  263. local AntiGravity = Instance.new("BodyForce", Bullet)
  264. AntiGravity.Force = Vector3.new(0, Bullet:GetMass() * workspace.Gravity, 0)
  265.  
  266. local Start = (GUN.CFrame * CFrame.new(0.255, 0.251, 1.877)).p
  267. Bullet.CFrame = CFrame.new(Start, Mouse.Hit.p)
  268. Bullet.Velocity = Bullet.CFrame.lookVector * 300
  269.  
  270. Bullet.Touched:Connect(function(Hit)
  271. if Hit.Parent and Hit.Parent ~= Character and Hit.Parent:FindFirstChild("Humanoid") then
  272. Hit.Parent.Humanoid:TakeDamage(5)
  273. Bullet:Destroy()
  274. end
  275. end)
  276.  
  277. Bullet.Parent = workspace
  278. game.Debris:AddItem(Bullet, 3)
  279. end
  280.  
  281.  
  282. game:GetService("RunService"):BindToRenderStep("Invisible", Enum.RenderPriority.Character.Value - 1, function()
  283. GUN.LocalTransparencyModifier = 0
  284. FL.LocalTransparencyModifier = 0
  285. LS.Part1.LocalTransparencyModifier = 0
  286. RS.Part1.LocalTransparencyModifier = 0
  287. end)
  288.  
  289. local Heartbeat, Angle = game:GetService("RunService").Heartbeat
  290.  
  291. while Heartbeat:Wait() do
  292. local Angle = tick() * 8
  293.  
  294. -- Torso lean
  295. local VelocityForTilt = RootPart.Velocity * Vector3.new(1, 0, 1) / 150
  296. local VectorForTilt = RootPart.CFrame:vectorToObjectSpace(VelocityForTilt)
  297. RJ.C0 = RJ.C0:Lerp(STANCE.RJ * CFrame.Angles(VectorForTilt.Z, VectorForTilt.X, -VectorForTilt.X), 0.1)
  298.  
  299. -- Rotate to face camera
  300. local RootPosition = RootPart.Position
  301. local Direction = Mouse.Hit.p - RootPosition
  302. Direction = Vector3.new(Direction.X, 0, Direction.Z).unit
  303. local NewCFrame = CFrame.new(RootPosition, RootPosition + Direction) * CFrame.Angles(0, -0.02, 0)
  304. RootPart.CFrame = RootPart.CFrame:Lerp(NewCFrame, 0.1)
  305.  
  306. -- Neck Angle
  307. local Hypotenuse = (Mouse.Hit.p - Head.Position).magnitude
  308. local Opposite = Mouse.Hit.p.y - Head.Position.y
  309. local Pitch = math.asin(Opposite / Hypotenuse)
  310. local NewNeckCFrame = STANCE.NK * CFrame.Angles(Pitch + 0.2, 0, 0) * CFrame.new(0, 0.5, 0)
  311. Neck.C0 = Neck.C0:Lerp(NewNeckCFrame, 0.1)
  312.  
  313. -- Legs
  314. local FlatVelocity = (Torso.Velocity * Vector3.new(1, 0, 1))
  315. if FlatVelocity.magnitude < 2 then
  316. LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, -1, 0) * CFrame.Angles(math.sin(tick() * 0.5) / 17, 0, -0.02 + math.sin(tick() * 0.4) / 19) * CFrame.new(0, -1, 0), 0.2)
  317. RH.C0 = RH.C0:Lerp(CFrame.new(0.5, -1, 0) * CFrame.Angles(math.sin(-tick() * 0.5) / 18, 0, 0.02 + math.sin(-tick() * 0.35) / 20) * CFrame.new(0, -1, 0), 0.2)
  318. else
  319. local Look = (Torso.CFrame.lookVector * Vector3.new(1, 0, 1)).unit
  320. local Move = FlatVelocity.unit
  321. local OffAngle = (Look:Cross(Move).Y > 0 and 1 or -1) * math.acos(1 - (Look - Move).magnitude ^ 2 / 2)
  322. OffAngle = math.max(-math.pi, math.min(math.pi, OffAngle))
  323. LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
  324. * CFrame.new(0, -math.max(0, math.cos(Angle * 2) / 5) + math.max(0, math.cos(Angle + math.pi) / 2.5) - 2, math.sin(-Angle + math.pi) / 1.8 + 0.15)
  325. * CFrame.Angles(math.sin(-Angle) / 1.8 - 0.2, 0, 0), 0.2)
  326. RH.C0 = RH.C0:Lerp(CFrame.new(0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
  327. * CFrame.new(0, -math.max(0, math.cos(Angle * 2) / 5) + math.max(0, math.cos(Angle) / 2.5) - 2, math.sin(-Angle) / 1.8 + 0.15)
  328. * CFrame.Angles(math.sin(Angle) / 1.8 - 0.2, 0, 0), 0.2)
  329. end
  330.  
  331. -- Shooting
  332. if Down then
  333. SN.Volume = SN.Volume + (1.5 - SN.Volume) * 0.3
  334. FL.Transparency = FL.Transparency + (0.6 - FL.Transparency) * 0.2
  335. FLW.C0 = FLW.C0 * CFrame.Angles(0, 0.2, 0)
  336. Shoot()
  337. else
  338. SN.Volume = SN.Volume + (0 - SN.Volume) * 0.15
  339. FL.Transparency = FL.Transparency + (1 - FL.Transparency) * 0.2
  340. end
  341. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement