Advertisement
Hermaxs

TF2 Heavy

Feb 27th, 2019
1,587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.04 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
  6.  
  7.  
  8. local Player = game:GetService("Players").LocalPlayer
  9. local Character = Player.Character
  10. local Mouse = Player:GetMouse()
  11. --Mouse.TargetFilter = workspace
  12.  
  13. local Head = Character:WaitForChild("Head")
  14. local Torso = Character:WaitForChild("Torso")
  15. local RootPart = Character:WaitForChild("HumanoidRootPart")
  16. local Human = Character:WaitForChild("Humanoid")
  17.  
  18. Human.AutoRotate = false
  19. Human.JumpPower = 0
  20. Human.WalkSpeed = 12
  21.  
  22. -----------------------------------------------------------------------------------------------------------------------
  23.  
  24. for _, Item in next, Character:GetChildren() do
  25. if Item:IsA("CharacterAppearance") then
  26. Item:Destroy()
  27. end
  28. end
  29.  
  30. local Pants = Character:FindFirstChild("Pants") or Instance.new("Pants")
  31. Pants.PantsTemplate = "rbxassetid://69232474"
  32. Pants.Name = "Pants"
  33. Pants.Parent = Character
  34.  
  35. local Shirt = Character:FindFirstChild("Shirt") or Instance.new("Shirt")
  36. Shirt.ShirtTemplate = "rbxassetid://69232183"
  37. Shirt.Name = "Shirt"
  38. Shirt.Parent = Character
  39.  
  40. local Face = Head:WaitForChild("face")
  41. Face.Texture = "rbxassetid://112805849"
  42.  
  43. local TShirt = Torso:FindFirstChild("roblox")
  44. if TShirt then
  45. TShirt:Destroy()
  46. end
  47.  
  48. --[[local BodyColors = Character:WaitForChild("Body Colors")
  49. BodyColors.HeadColor = BrickColor.new("Light orange")
  50. BodyColors.LeftArmColor = BrickColor.new("Light orange")
  51. BodyColors.RightArmColor = BrickColor.new("Light orange")
  52. BodyColors.TorsoColor = BrickColor.new("Light orange")--]]
  53.  
  54. spawn(function() wait(.5)
  55. Head.BrickColor = BrickColor.new("Light orange")
  56. Torso.BrickColor = BrickColor.new("Light orange")
  57. Character["Left Arm"].BrickColor = BrickColor.new("Light orange")
  58. Character["Right Arm"].BrickColor = BrickColor.new("Light orange")
  59. end)
  60.  
  61. Character:WaitForChild("Animate"):Destroy()
  62.  
  63. local RJ = RootPart:WaitForChild("RootJoint")
  64. RJ:Destroy()
  65. RJ = Instance.new("Weld", RootPart)
  66. RJ.Part0 = RootPart
  67. RJ.Part1 = Torso
  68.  
  69. local Neck = Instance.new("Weld", Torso)
  70. Neck.Part0 = Torso
  71. Neck.Part1 = Character:WaitForChild("Head")
  72. Neck.C0 = CFrame.new(0, 1.5, 0)
  73.  
  74. Torso:WaitForChild("Right Shoulder").Part1 = nil
  75. local RS = Instance.new("Weld", Head)
  76. RS.Part0 = Head
  77. RS.Part1 = Character:WaitForChild("Right Arm")
  78.  
  79. Torso:WaitForChild("Left Shoulder").Part1 = nil
  80. local LS = Instance.new("Weld", Head)
  81. LS.Part0 = Head
  82. LS.Part1 = Character:WaitForChild("Left Arm")
  83.  
  84. local LH = Torso:WaitForChild("Left Hip")
  85. LH:Destroy()
  86. LH = Instance.new("Weld", Torso)
  87. LH.Part0 = Torso
  88. LH.Part1 = Character:WaitForChild("Left Leg")
  89.  
  90. local RH = Torso:WaitForChild("Right Hip")
  91. RH:Destroy()
  92. RH = Instance.new("Weld", Torso)
  93. RH.Part0 = Torso
  94. RH.Part1 = Character:WaitForChild("Right Leg")
  95.  
  96. local GUN = Instance.new("Part", Character)
  97. GUN.CanCollide = false
  98. GUN.Size = Vector3.new(1.549, 2.302, 3.814)
  99. GUN.Name = "Handle"
  100. GUN.Material = Enum.Material.SmoothPlastic
  101.  
  102. local MS = Instance.new("SpecialMesh", GUN)
  103. MS.MeshType = Enum.MeshType.FileMesh
  104. MS.MeshId = "rbxassetid://450812185"
  105. MS.TextureId = "rbxassetid://450812194"
  106.  
  107. local GRIP = Instance.new("Weld", RS.Part1)
  108. GRIP.Part0 = RS.Part1
  109. GRIP.Part1 = GUN
  110.  
  111. local SN = Instance.new("Sound", GUN)
  112. SN.SoundId = "rbxassetid://341294387"
  113. SN.PlaybackSpeed = 0.9
  114. SN.Looped = true
  115. SN.Volume = 0
  116. SN:Play()
  117.  
  118. local FL = Instance.new("Part", GUN)
  119. FL.BrickColor = BrickColor.Yellow()
  120. FL.Transparency = 1
  121. FL.Material = Enum.Material.SmoothPlastic
  122. FL.CanCollide = false
  123. FL.Size = Vector3.new(1, 3.38, 1)
  124.  
  125. local MS2 = Instance.new("SpecialMesh", FL)
  126. MS2.MeshType = Enum.MeshType.FileMesh
  127. MS2.MeshId = "rbxassetid://1323306"
  128. MS2.Scale = Vector3.new(0.35, 1.9, 0.35)
  129.  
  130. local FLW = Instance.new("Weld", GUN)
  131. FLW.Part0 = GUN
  132. FLW.Part1 = FL
  133. FLW.C0 = CFrame.new(0.293, 0.251, 3.221, 0, 0.028, 1, 1, 0, 0, 0, 1, -0.028)
  134.  
  135. -----------------------------------------------------------------------------------------------------------------------
  136.  
  137. local STANCE = {
  138. NK = CFrame.new(0, 1, 0, 0.747311652, 0, 0.664473772, 0, 1, 0, -0.664473772, 0, 0.747311652);
  139. RJ = CFrame.new(0, 0, 0, 0.747311592, 0, -0.664473712, 0, 1, 0, 0.664473712, 0, 0.747311592);
  140. 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);
  141. 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);
  142. 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);
  143. }
  144.  
  145. LS.C0 = STANCE.LS
  146. RS.C0 = STANCE.RS
  147. RJ.C0 = STANCE.RJ
  148. GRIP.C0 = STANCE.GRIP
  149.  
  150. local Down = false
  151.  
  152. Mouse.Button1Down:Connect(function()
  153. Down = true
  154. end)
  155.  
  156. Mouse.Button1Up:Connect(function()
  157. Down = false
  158. end)
  159.  
  160. math.randomseed(os.time())
  161.  
  162. local function Taunt()
  163. local Taunts = {137542750, 130774824, 130776108, 679798995, 679798810}
  164. local Sound = Instance.new("Sound", GUN)
  165. local Id = Taunts[math.random(#Taunts)]
  166. Sound.TimePosition = Id == 130776108 and 4.2 or 0
  167. Sound.SoundId = "rbxassetid://" .. Id
  168. Sound.Volume = 1
  169. Sound.Ended:Connect(function()
  170. Sound:Destroy()
  171. end)
  172. Sound:Play()
  173. end
  174.  
  175. Mouse.KeyDown:Connect(function(Key)
  176. if Key == string.char(32) then
  177. Taunt()
  178. end
  179. end)
  180.  
  181.  
  182.  
  183. local function Shoot()
  184. local Bullet = Instance.new("Part")
  185. Bullet.Size = Vector3.new(0.3, 0.3, 0.7)
  186. Bullet.Transparency = 1
  187. Bullet.CanCollide = false
  188.  
  189. local AntiGravity = Instance.new("BodyForce", Bullet)
  190. AntiGravity.Force = Vector3.new(0, Bullet:GetMass() * workspace.Gravity, 0)
  191.  
  192. local Start = (GUN.CFrame * CFrame.new(0.255, 0.251, 1.877)).p
  193. Bullet.CFrame = CFrame.new(Start, Mouse.Hit.p)
  194. Bullet.Velocity = Bullet.CFrame.lookVector * 300
  195.  
  196. Bullet.Touched:Connect(function(Hit)
  197. if Hit.Parent and Hit.Parent ~= Character and Hit.Parent:FindFirstChild("Humanoid") then
  198. Hit.Parent.Humanoid:TakeDamage(5)
  199. Bullet:Destroy()
  200. end
  201. end)
  202.  
  203. Bullet.Parent = workspace
  204. game.Debris:AddItem(Bullet, 3)
  205. end
  206.  
  207.  
  208. game:GetService("RunService"):BindToRenderStep("Invisible", Enum.RenderPriority.Character.Value - 1, function()
  209. GUN.LocalTransparencyModifier = 0
  210. FL.LocalTransparencyModifier = 0
  211. LS.Part1.LocalTransparencyModifier = 0
  212. RS.Part1.LocalTransparencyModifier = 0
  213. end)
  214.  
  215. local Heartbeat, Angle = game:GetService("RunService").Heartbeat
  216.  
  217. while Heartbeat:Wait() do
  218. local Angle = tick() * 8
  219.  
  220. -- Torso lean
  221. local VelocityForTilt = RootPart.Velocity * Vector3.new(1, 0, 1) / 150
  222. local VectorForTilt = RootPart.CFrame:vectorToObjectSpace(VelocityForTilt)
  223. RJ.C0 = RJ.C0:Lerp(STANCE.RJ * CFrame.Angles(VectorForTilt.Z, VectorForTilt.X, -VectorForTilt.X), 0.1)
  224.  
  225. -- Rotate to face camera
  226. local RootPosition = RootPart.Position
  227. local Direction = Mouse.Hit.p - RootPosition
  228. Direction = Vector3.new(Direction.X, 0, Direction.Z).unit
  229. local NewCFrame = CFrame.new(RootPosition, RootPosition + Direction) * CFrame.Angles(0, -0.02, 0)
  230. RootPart.CFrame = RootPart.CFrame:Lerp(NewCFrame, 0.1)
  231.  
  232. -- Neck Angle
  233. local Hypotenuse = (Mouse.Hit.p - Head.Position).magnitude
  234. local Opposite = Mouse.Hit.p.y - Head.Position.y
  235. local Pitch = math.asin(Opposite / Hypotenuse)
  236. local NewNeckCFrame = STANCE.NK * CFrame.Angles(Pitch + 0.2, 0, 0) * CFrame.new(0, 0.5, 0)
  237. Neck.C0 = Neck.C0:Lerp(NewNeckCFrame, 0.1)
  238.  
  239. -- Legs
  240. local FlatVelocity = (Torso.Velocity * Vector3.new(1, 0, 1))
  241. if FlatVelocity.magnitude < 2 then
  242. 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)
  243. 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)
  244. else
  245. local Look = (Torso.CFrame.lookVector * Vector3.new(1, 0, 1)).unit
  246. local Move = FlatVelocity.unit
  247. local OffAngle = (Look:Cross(Move).Y > 0 and 1 or -1) * math.acos(1 - (Look - Move).magnitude ^ 2 / 2)
  248. OffAngle = math.max(-math.pi, math.min(math.pi, OffAngle))
  249. LH.C0 = LH.C0:Lerp(CFrame.new(-0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
  250. * 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)
  251. * CFrame.Angles(math.sin(-Angle) / 1.8 - 0.2, 0, 0), 0.2)
  252. RH.C0 = RH.C0:Lerp(CFrame.new(0.5, 0, 0) * CFrame.Angles(0, OffAngle, 0)
  253. * 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)
  254. * CFrame.Angles(math.sin(Angle) / 1.8 - 0.2, 0, 0), 0.2)
  255. end
  256.  
  257. -- Shooting
  258. if Down then
  259. SN.Volume = SN.Volume + (1.5 - SN.Volume) * 0.3
  260. FL.Transparency = FL.Transparency + (0.6 - FL.Transparency) * 0.2
  261. FLW.C0 = FLW.C0 * CFrame.Angles(0, 0.2, 0)
  262. Shoot()
  263. else
  264. SN.Volume = SN.Volume + (0 - SN.Volume) * 0.15
  265. FL.Transparency = FL.Transparency + (1 - FL.Transparency) * 0.2
  266. end
  267. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement