Advertisement
samuelrichter66

tf2 hoovi

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