niggerfaggggggot

Untitled

May 19th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. local h,t
  87. --Give the server mouse data every second frame, but only if the values changed
  88. --If player is not moving their mouse, client won't fire events
  89. local HB = game:GetService("RunService").Heartbeat
  90. while true do
  91. if h~=Mouse.Hit or t~=Mouse.Target then
  92. h,t=Mouse.Hit,Mouse.Target
  93. Event:FireServer({isMouse=true,Target=t,Hit=h})
  94. end
  95. --Wait 2 frames
  96. for i=1,2 do
  97. HB:Wait()
  98. end
  99. end]==],script)
  100.  
  101. ----Sandboxed game object that allows the usage of client-side methods and services
  102. --Real game object
  103. local RealGame = game
  104.  
  105. --Metatable for fake service
  106. local FakeService_Metatable = {
  107. __index = function(self,k)
  108. local s = rawget(self,"_RealService")
  109. if s then
  110. return typeof(s[k])=="function"
  111. and function(_,...)return s[k](s,...)end or s[k]
  112. end
  113. end,
  114. __newindex = function(self,k,v)
  115. local s = rawget(self,"_RealService")
  116. if s then s[k]=v end
  117. end
  118. }
  119. local function FakeService(t,RealService)
  120. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  121. return setmetatable(t,FakeService_Metatable)
  122. end
  123.  
  124. --Fake game object
  125. local FakeGame = {
  126. GetService = function(self,s)
  127. return rawget(self,s) or RealGame:GetService(s)
  128. end,
  129. Players = FakeService({
  130. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  131. },"Players"),
  132. UserInputService = FakeService(UIS,"UserInputService"),
  133. ContextActionService = FakeService(CAS,"ContextActionService"),
  134. RunService = FakeService({
  135. _btrs = {},
  136. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  137. BindToRenderStep = function(self,name,_,fun)
  138. self._btrs[name] = self.Heartbeat:Connect(fun)
  139. end,
  140. UnbindFromRenderStep = function(self,name)
  141. self._btrs[name]:Disconnect()
  142. end,
  143. },"RunService")
  144. }
  145. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  146. FakeGame.service = FakeGame.GetService
  147. FakeService(FakeGame,game)
  148. --Changing owner to fake player object to support owner:GetMouse()
  149. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  150. end
  151. local Players = game:GetService("Players")
  152. local RunService = game:GetService("RunService")
  153.  
  154. local Player = Players.LocalPlayer
  155. local Camera = workspace.CurrentCamera
  156. local Mouse = Player:GetMouse()
  157. local Camera = workspace.CurrentCamera
  158. local Character = Player.Character
  159. local Humanoid = Character:FindFirstChild("Humanoid")
  160. local Head = Character:FindFirstChild("Head")
  161. local Torso = Character:FindFirstChild("Torso")
  162. local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
  163. local RightArm = Character:FindFirstChild("Right Arm")
  164. local LeftArm = Character:FindFirstChild("Left Arm")
  165. local RightLeg = Character:FindFirstChild("Right Leg")
  166. local LeftLeg = Character:FindFirstChild("Left Leg")
  167.  
  168.  
  169.  
  170. local Funcs = {}
  171.  
  172.  
  173. local Animation = "Standing"
  174.  
  175.  
  176. local charWelds = {}
  177.  
  178. local Config = {
  179. standingSway = math.pi/45;
  180. walkingSway = math.pi/14;
  181. standingOffset = math.pi/80;
  182. walkingOffset = math.pi/48;
  183. }
  184.  
  185.  
  186.  
  187. Humanoid.WalkSpeed = 22.4
  188. Humanoid.JumpPower = 40
  189.  
  190. --Camera.CameraType = "Scriptable"
  191.  
  192.  
  193.  
  194.  
  195. charWelds.HumanoidRootPart = Instance.new("Weld", HumanoidRootPart)
  196. charWelds.HumanoidRootPart.Part0 = HumanoidRootPart
  197. charWelds.HumanoidRootPart.Part1 = Torso
  198.  
  199. charWelds.rightArmWeld = Instance.new("Weld", Torso)
  200. charWelds.rightArmWeld.Part0 = Torso
  201. charWelds.rightArmWeld.Part1 = RightArm
  202. charWelds.rightArmWeld.C0 = CFrame.new(1.5, .5, 0)
  203. charWelds.rightArmWeld.C1 = CFrame.new(0, .5, 0)
  204.  
  205. charWelds.leftArmWeld = Instance.new("Weld", Torso)
  206. charWelds.leftArmWeld.Part0 = Torso
  207. charWelds.leftArmWeld.Part1 = LeftArm
  208. charWelds.leftArmWeld.C0 = CFrame.new(-1.5, .5, 0)
  209. charWelds.leftArmWeld.C1 = CFrame.new(0, .5, 0)
  210.  
  211. charWelds.rightLegWeld = Instance.new("Weld", Torso)
  212. charWelds.rightLegWeld.Part0 = Torso
  213. charWelds.rightLegWeld.Part1 = RightLeg
  214. charWelds.rightLegWeld.C0 = CFrame.new(.5, -1.5, 0)
  215. charWelds.rightLegWeld.C1 = CFrame.new(0, .5, 0)
  216.  
  217. charWelds.leftLegWeld = Instance.new("Weld", Torso)
  218. charWelds.leftLegWeld.Part0 = Torso
  219. charWelds.leftLegWeld.Part1 = LeftLeg
  220. charWelds.leftLegWeld.C0 = CFrame.new(-.5, -1.5, 0)
  221. charWelds.leftLegWeld.C1 = CFrame.new(0, .5, 0)
  222.  
  223. local Equipment = Instance.new("Folder", Character)
  224.  
  225.  
  226.  
  227.  
  228. function Funcs.CFrameInterpolate(oc, c, v)
  229. local oc1, oc2, oc3, oc4, oc5, oc6, oc7, oc8, oc9, oc10, oc11, oc12 = oc:components()
  230. local c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12 = c:components()
  231. return CFrame.new(
  232. oc1 + (c1 - oc1) * v, oc2 + (c2 - oc2) * v, oc3 + (c3 - oc3) * v, oc4 + (c4 - oc4) * v, oc5 + (c5 - oc5) * v, oc6 + (c6 - oc6) * v
  233. , oc7 + (c7 - oc7) * v, oc8 + (c8 - oc8) * v, oc9 + (c9 - oc9) * v, oc10 + (c10 - oc10) * v, oc11 + (c11 - oc11) * v, oc12 + (c12 - oc12) * v
  234. )
  235. end
  236.  
  237. function Funcs.Trail(p, c1, c2)
  238. local mag = (c2.p - c1.p).magnitude
  239. p.Size = Vector3.new(0, 0, mag)
  240. p.CFrame = CFrame.new(c1.p:Lerp(c2.p, 0.5))
  241. p.CFrame = CFrame.new(p.CFrame.p, c2.p)
  242. end
  243.  
  244. function Funcs.AngleInterpolate(w,c,x,y,z,x1,y1,z1,l)
  245. w.C1 = c * CFrame.fromEulerAnglesXYZ(
  246. x + math.sin(math.pi / 2 * l) * (x1 - x)
  247. , y + math.sin(math.pi / 2 * l) * (y1 - y)
  248. , z + math.sin(math.pi / 2 * l) * (z1 - z)
  249. )
  250. end
  251.  
  252. function Funcs.Part(Parent, t)
  253. local Part = Instance.new("Part", Parent)
  254. Part.BrickColor = t[2]
  255. Part.FormFactor = 3
  256. Part.TopSurface, Part.BottomSurface, Part.LeftSurface, Part.RightSurface
  257. , Part.FrontSurface, Part.BackSurface = 10, 10, 10, 10, 10, 10
  258. Part.CanCollide = t[1]
  259. Part.Transparency = t[3]
  260. Part.Material = t[4]
  261. Part.Reflectance = t[5]
  262. Part.Shape = t[6]
  263. Part.Size = t[7]
  264. return Part
  265. end
  266.  
  267. function Funcs.BlockMesh(Part, Scale)
  268. local BlockMesh = Instance.new("BlockMesh", Part)
  269. BlockMesh.Scale = Scale
  270. return BlockMesh
  271. end
  272.  
  273. function Funcs.CylinderMesh(Part, Scale)
  274. local CylinderMesh = Instance.new("CylinderMesh", Part)
  275. CylinderMesh.Scale = Scale
  276. return CylinderMesh
  277. end
  278.  
  279. function Funcs.SpecialMesh(Part, Scale, MeshType)
  280. local SpecialMesh = Instance.new("SpecialMesh", Part)
  281. SpecialMesh.Scale = Scale
  282. SpecialMesh.MeshType = MeshType
  283. return SpecialMesh
  284. end
  285.  
  286. function Funcs.Weld(Part0, Part1, C0)
  287. local Weld = Instance.new("Weld", Part0)
  288. Weld.Part0, Weld.Part1, Weld.C0 = Part0, Part1, C0
  289. return Weld
  290. end
  291.  
  292. function Funcs.AddEquipment()
  293.  
  294. Whip = Funcs.Part(Equipment, {true, BrickColor.new("Brown"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0.2, 0.2, 1.6)})
  295. local WhipWeld = Funcs.Weld(RightArm, Whip, CFrame.new(0, -1.1, -0.6))
  296.  
  297. Rope = Funcs.Part(Equipment, {false, BrickColor.new("Really black"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 1)})
  298. local RopeMesh = Funcs.BlockMesh(Rope, Vector3.new(0.4, 0.4, 1))
  299. Rope.Anchored = true
  300.  
  301. RopeE = Funcs.Part(Equipment, {false, BrickColor.new("Dark stone grey"), 0, Enum.Material.SmoothPlastic, 0, Enum.PartType.Block, Vector3.new(0, 0, 0)})
  302. local RopeEMesh = Funcs.SpecialMesh(RopeE, Vector3.new(0.8, 0.8, 0.8), "Sphere")
  303. RopeE.Anchored = true
  304.  
  305. end
  306.  
  307. local ropeEnd = CFrame.new(0, 0, 0)
  308.  
  309. function Funcs.Whip()
  310. if Animation ~= "Throwing" then
  311. Animation = "Throwing"
  312.  
  313. for i = 0, 1, 0.1 do
  314. Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0)
  315. , 0, 0, 0, 0, math.pi / 8, 0, i)
  316. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  317. , 0, 0, -math.pi / 8, -math.pi * 5 / 4, 0, math.pi / 12, i)
  318. wait()
  319. end
  320.  
  321. local targ = Mouse.Target
  322. local cf = Mouse.Hit
  323.  
  324. for i = 0, 1, 0.2 do
  325. Funcs.AngleInterpolate(charWelds.HumanoidRootPart, CFrame.new(0, 0, 0)
  326. , 0, math.pi / 8, 0, 0, 0, 0, i)
  327. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  328. , -math.pi * 5 / 4, 0, math.pi / 8, 0, 0, -math.pi / 12, i)
  329. wait()
  330. end
  331.  
  332. if (Torso.Position - cf.p).magnitude < 120 then
  333. ropeEnd = cf
  334.  
  335. wait(1 / 2)
  336. if targ and targ.Parent and targ.Parent:FindFirstChild("Humanoid") then
  337. targ.Parent:BreakJoints()
  338. end
  339.  
  340. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  341. end
  342.  
  343. Animation = "Standing"
  344. end
  345. end
  346.  
  347. local Snd = Instance.new("Sound", Torso)
  348. Snd.SoundId = "rbxassetid://163277488"
  349. Snd.Volume = 100
  350.  
  351. Mouse.Button1Down:connect(function()
  352. Snd:Play()
  353. Funcs.Whip()
  354. end)
  355.  
  356.  
  357. Funcs.AddEquipment()
  358.  
  359. local i = 0
  360. local camGoal = Head.CFrame
  361. local ropeCEnd = RightArm.CFrame
  362. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  363.  
  364.  
  365. RunService.Stepped:connect(function()
  366.  
  367.  
  368. local animSpeed = 0.02
  369. local offsetMultiplier = 1
  370.  
  371.  
  372. local ropeStart = Whip.CFrame * CFrame.new(0, 0, -0.7)
  373. ropeCEnd = CFrame.new(ropeCEnd.p:Lerp(ropeEnd.p, 0.2))
  374. RopeE.CFrame = ropeCEnd
  375. if Animation ~= "Throwing" then
  376. ropeEnd = Whip.CFrame * CFrame.new(0, -1.8, -0.7)
  377. end
  378.  
  379. Funcs.Trail(Rope, ropeStart, ropeCEnd)
  380.  
  381.  
  382.  
  383. if Humanoid.Jump == true then
  384. if Animation ~= "Throwing" then
  385. Animation = "Jumping"
  386.  
  387. end
  388. animSpeed = 0.001
  389. offsetMultiplier = 3
  390. elseif Torso.Velocity.magnitude > 0.4 then
  391. if Animation ~= "Throwing" then
  392. Animation = "Walking"
  393. end
  394. animSpeed = 0.1
  395. offsetMultiplier = 1
  396. else
  397. if Animation ~= "Throwing" then
  398. Animation = "Standing"
  399. end
  400. animSpeed = 0.02
  401. offsetMultiplier = 1
  402. end
  403.  
  404.  
  405. if i < 2 then
  406. i = i + animSpeed
  407. else
  408. i = 0
  409. end
  410.  
  411.  
  412. if Animation == "Standing" or Animation == "Throwing" then
  413. if i < 1 then
  414. if Animation ~= "Throwing" then
  415. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  416. , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i)
  417. end
  418. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  419. , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i)
  420. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  421. , Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i)
  422. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  423. , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i)
  424. elseif i >= 1 then
  425. if Animation ~= "Throwing" then
  426. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  427. , -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, Config.standingSway, 0, -Config.standingOffset * offsetMultiplier, i - 1)
  428. end
  429. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  430. , Config.standingSway, 0, Config.standingOffset * offsetMultiplier, -Config.standingSway, 0, Config.standingOffset * offsetMultiplier, i - 1)
  431. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  432. , -Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, Config.standingSway, 0, Config.standingOffset * offsetMultiplier / 2, i - 1)
  433. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  434. , Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, -Config.standingSway, 0, -Config.standingOffset * offsetMultiplier / 2, i - 1)
  435. end
  436. end
  437. if Animation == "Walking" or Animation == "Jumping" or Animation == "Throwing" or Animation == "Shooting" then
  438. if i < 1 then
  439. if Animation ~= "Throwing" then
  440. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  441. , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i)
  442. end
  443. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  444. , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i)
  445. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  446. , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i)
  447. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  448. , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i)
  449. elseif i >= 1 then
  450. if Animation ~= "Throwing" then
  451. Funcs.AngleInterpolate(charWelds.rightArmWeld, CFrame.new(0,.5,0)
  452. , -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier, i - 1)
  453. end
  454. Funcs.AngleInterpolate(charWelds.leftArmWeld, CFrame.new(0,.5,0)
  455. , Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier, i - 1)
  456. Funcs.AngleInterpolate(charWelds.leftLegWeld, CFrame.new(0,.5,0)
  457. , -Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, Config.walkingSway, 0, Config.walkingOffset * offsetMultiplier / 2, i - 1)
  458. Funcs.AngleInterpolate(charWelds.rightLegWeld, CFrame.new(0,.5,0)
  459. , Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, -Config.walkingSway, 0, -Config.walkingOffset * offsetMultiplier / 2, i - 1)
  460. end
  461. end
  462.  
  463. end)
Add Comment
Please, Sign In to add comment