Advertisement
Rawscript

Untitled

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