Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.36 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.  
  84. plr = owner
  85. char = plr.Character
  86. hum = char.Humanoid
  87. local cam = game.Workspace.CurrentCamera
  88. Camera = cam
  89. local CamInterrupt = false
  90. local TwoD = false
  91. local TargetInfo = {nil, nil}
  92. cam.CameraType = "Custom"
  93. t = char.Torso
  94. h = char.Head
  95. ra = char["Right Arm"]
  96. la = char["Left Arm"]
  97. rl = char["Right Leg"]
  98. ll = char["Left Leg"]
  99. tors = char.Torso
  100. lleg = char["Left Leg"]
  101. root = char.HumanoidRootPart
  102. hed = char.Head
  103. rleg = char["Right Leg"]
  104. rarm = char["Right Arm"]
  105. larm = char["Left Arm"]
  106. radian = math.rad
  107. random = math.random
  108. Vec3 = Vector3.new
  109. Inst = Instance.new
  110. cFrame = CFrame.new
  111. Euler = CFrame.fromEulerAnglesXYZ
  112. vt = Vector3.new
  113. bc = BrickColor.new
  114. br = BrickColor.random
  115. it = Instance.new
  116. cf = CFrame.new
  117. RW, LW = Instance.new("Weld"), Instance.new("Weld")
  118. RW.Name = "Right Shoulder"
  119. LW.Name = "Left Shoulder"
  120. LH = tors["Left Hip"]
  121. RH = tors["Right Hip"]
  122. player = Player
  123. ch = Character
  124. RSH = char.Torso["Right Shoulder"]
  125. LSH = char.Torso["Left Shoulder"]
  126. RSH.Parent = nil
  127. LSH.Parent = nil
  128. RW.Name = "Right Shoulder"
  129. RW.Part0 = char.Torso
  130. RW.C0 = cf(1.5, 0.5, 0)
  131. RW.C1 = cf(0, 0.5, 0)
  132. RW.Part1 = char["Right Arm"]
  133. RW.Parent = char.Torso
  134. LW.Name = "Left Shoulder"
  135. LW.Part0 = char.Torso
  136. LW.C0 = cf(-1.5, 0.5, 0)
  137. LW.C1 = cf(0, 0.5, 0)
  138. LW.Part1 = char["Left Arm"]
  139. LW.Parent = char.Torso
  140. Player = owner
  141. Character = Player.Character
  142. PlayerGui = Player.PlayerGui
  143. Backpack = Player.Backpack
  144. Torso = Character.Torso
  145. Head = Character.Head
  146. Humanoid = Character.Humanoid
  147. m = Instance.new("Model", Character)
  148. LeftArm = Character["Left Arm"]
  149. LeftLeg = Character["Left Leg"]
  150. RightArm = Character["Right Arm"]
  151. RightLeg = Character["Right Leg"]
  152. LS = Torso["Left Shoulder"]
  153. LH = Torso["Left Hip"]
  154. RS = Torso["Right Shoulder"]
  155. RH = Torso["Right Hip"]
  156. Face = Head.face
  157. Neck = Torso.Neck
  158. it = Instance.new
  159. attacktype = 1
  160. vt = Vector3.new
  161. cf = CFrame.new
  162. euler = CFrame.fromEulerAnglesXYZ
  163. angles = CFrame.Angles
  164. cloaked = false
  165. necko = cf(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  166. necko2 = cf(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  167. LHC0 = cf(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  168. LHC1 = cf(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  169. RHC0 = cf(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  170. RHC1 = cf(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
  171. RootPart = Character.HumanoidRootPart
  172. RootJoint = RootPart.RootJoint
  173. sine = 0
  174. RootCF = euler(-1.57, 0, 3.14)
  175. deb = false
  176.  
  177. local part = it("Part", char)
  178. local mesh = it("SpecialMesh", part)
  179. hits = it("Sound", part)
  180. swing = it("Sound", part)
  181.  
  182. mesh.MeshId = "http://www.roblox.com/asset/?id=54983181"
  183. mesh.TextureId = "http://www.roblox.com/asset/?id=55764440"
  184. mesh.Scale = vt(2,2,2)
  185. part.Size = vt(4, 4, 4.2)
  186. part.CanCollide = false
  187. hits.SoundId = "rbxassetid://1621591319"
  188. hits.Volume = 1
  189. hits.TimePosition = 1
  190. swing.SoundId = "rbxassetid://4571259077"
  191. swing.Volume = 2
  192.  
  193. function createHitbox()
  194. local hitbox1 = Instance.new("Part", part)
  195. hitbox1.Size = part.Size
  196. hitbox1.Transparency = 1
  197. hitbox1.CanCollide = false
  198. weld(part,hitbox1,part.CFrame,part.CFrame)
  199. hitbox1.Touched:Connect(function(hit)
  200. if hit.Parent:FindFirstChild("Humanoid") then
  201. hitbox1:Destroy()
  202. print("hit")
  203. hits:Play()
  204. vel = Instance.new("BodyVelocity", workspace)
  205. angvel = Instance.new("BodyAngularVelocity", workspace)
  206. if hit.Parent.Name ~= plr.Name then
  207. e = hit.Parent:FindFirstChild("Torso")
  208. angvel.Parent = e
  209. angvel.MaxTorque = Vector3.new(99999999999999900000000000000,99999999999999999999999999999990,900000000000000000000000000)
  210. vel.Parent = e
  211. vel.MaxForce = Vector3.new(99999999999999900000000000000,99999999999999999999999999999990,900000000000000000000000000)
  212. for i = 1,100 do
  213. angvel.AngularVelocity = angvel.AngularVelocity + Vector3.new(0,2,0)
  214. angvel.AngularVelocity = angvel.AngularVelocity + Vector3.new(0,0,2)
  215. angvel.AngularVelocity = angvel.AngularVelocity + Vector3.new(2,0,2)
  216. vel.Velocity = vel.Velocity + Vector3.new(0,2,0)
  217. vel.Velocity = vel.Velocity + Vector3.new(0,0,2)
  218. vel.Velocity = vel.Velocity + Vector3.new(2,0,2)
  219. end
  220. wait(20)
  221. vel:Destroy()
  222. angvel:Destroy()
  223. end
  224. end
  225. end)
  226. return hitbox1
  227. end
  228.  
  229. function weld(part0, part1, c0, c1)
  230. local weld = Instance.new("Weld", char)
  231. weld.Part0 = part0
  232. weld.Part1 = part1
  233. weld.C0 = c0
  234. weld.C1 = c1
  235. return weld
  236. end
  237.  
  238. function planb(part0, part1, c0)
  239. local weld = Instance.new("Weld", char)
  240. weld.Part0 = part0
  241. weld.Part1 = part1
  242. weld.C0 = c0
  243. return weld
  244. end
  245.  
  246. planb(ra, part, cf(part.CFrame.X, part.CFrame.Y - .5, part.CFrame.Z - 2) * angles(math.rad(180),math.rad(0),math.rad(0)))
  247.  
  248. function clerp(a, b, t)
  249. local qa = {
  250. QuaternionFromCFrame(a)
  251. }
  252. local qb = {
  253. QuaternionFromCFrame(b)
  254. }
  255. local ax, ay, az = a.x, a.y, a.z
  256. local bx, by, bz = b.x, b.y, b.z
  257. local _t = 1 - t
  258. return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
  259. end
  260.  
  261. function QuaternionFromCFrame(cf)
  262. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  263. local trace = m00 + m11 + m22
  264. if trace > 0 then
  265. local s = math.sqrt(1 + trace)
  266. local recip = 0.5 / s
  267. return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
  268. else
  269. local i = 0
  270. if m00 < m11 then
  271. i = 1
  272. end
  273. if m22 > (i == 0 and m00 or m11) then
  274. i = 2
  275. end
  276. if i == 0 then
  277. local s = math.sqrt(m00 - m11 - m22 + 1)
  278. local recip = 0.5 / s
  279. return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
  280. elseif i == 1 then
  281. local s = math.sqrt(m11 - m22 - m00 + 1)
  282. local recip = 0.5 / s
  283. return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
  284. elseif i == 2 then
  285. local s = math.sqrt(m22 - m00 - m11 + 1)
  286. local recip = 0.5 / s
  287. return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
  288. end
  289. end
  290. end
  291.  
  292. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  293. local xs, ys, zs = x + x, y + y, z + z
  294. local wx, wy, wz = w * xs, w * ys, w * zs
  295. local xx = x * xs
  296. local xy = x * ys
  297. local xz = x * zs
  298. local yy = y * ys
  299. local yz = y * zs
  300. local zz = z * zs
  301. return CFrame.new(px, py, pz, 1 - (yy + zz), xy - wz, xz + wy, xy + wz, 1 - (xx + zz), yz - wx, xz - wy, yz + wx, 1 - (xx + yy))
  302. end
  303.  
  304. function QuaternionSlerp(a, b, t)
  305. local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
  306. local startInterp, finishInterp
  307. if cosTheta >= 1.0E-4 then
  308. if 1 - cosTheta > 1.0E-4 then
  309. local theta = math.acos(cosTheta)
  310. local invSinTheta = 1 / math.sin(theta)
  311. startInterp = math.sin((1 - t) * theta) * invSinTheta
  312. finishInterp = math.sin(t * theta) * invSinTheta
  313. else
  314. startInterp = 1 - t
  315. finishInterp = t
  316. end
  317. elseif 1 + cosTheta > 1.0E-4 then
  318. local theta = math.acos(-cosTheta)
  319. local invSinTheta = 1 / math.sin(theta)
  320. startInterp = math.sin((t - 1) * theta) * invSinTheta
  321. finishInterp = math.sin(t * theta) * invSinTheta
  322. else
  323. startInterp = t - 1
  324. finishInterp = t
  325. end
  326. return a[1] * startInterp + b[1] * finishInterp, a[2] * startInterp + b[2] * finishInterp, a[3] * startInterp + b[3] * finishInterp, a[4] * startInterp + b[4] * finishInterp
  327. end
  328.  
  329. function swait(num)
  330. if num == 0 or num == nil then
  331. game:service("RunService").Stepped:wait(0)
  332. else
  333. for i = 0, num do
  334. game:service("RunService").Stepped:wait(0)
  335. end
  336. end
  337. end
  338.  
  339. for i = 0, 2, 0.1 do
  340. swait()
  341. RH.C0 = clerp(RH.C0, cf(1, -1 - 0.05 * math.cos(sine / 28), 0) * angles(math.rad(0), math.rad(90), math.rad(0)) * angles(math.rad(-2.5), math.rad(0), math.rad(0)), 0.4)
  342. LH.C0 = clerp(LH.C0, cf(-1, -1 - 0.05 * math.cos(sine / 28), 0) * angles(math.rad(0), math.rad(-90), math.rad(0)) * angles(math.rad(-2.5), math.rad(0), math.rad(0)), 0.4)
  343. RW.C0 = clerp(RW.C0, cf(1.5, 0.5 + 0.1 * math.cos(sine / 28), 0) * angles(math.rad(210), math.rad(0), math.rad(-10)), 0.4)
  344. LW.C0 = clerp(LW.C0, cf(0, 0.7, -.5) * angles(math.rad(130), math.rad(50), math.rad(90)), 0.4)
  345. end
  346.  
  347. Mouse.Button1Down:connect(function()
  348. if not deb then
  349. deb = true
  350. hum.WalkSpeed = 0
  351. swing:Play()
  352. hitbox = createHitbox()
  353. for i = 0, 2, 0.1 do
  354. swait()
  355. RW.C0 = clerp(RW.C0, cf(1.5, 0.5, -.5) * angles(math.rad(50), math.rad(0), math.rad(-30)), 0.4)
  356. LW.C0 = clerp(LW.C0, cf(0, 0.2, -.5) * angles(math.rad(90), math.rad(90), math.rad(-30)), 0.4)
  357. end
  358. wait(0.3)
  359. hum.WalkSpeed = 16
  360. hitbox:Destroy()
  361. for i = 0, 2, 0.1 do
  362. swait()
  363. RW.C0 = clerp(RW.C0, cf(1.5, 0.5 + 0.1 * math.cos(sine / 28), 0) * angles(math.rad(210), math.rad(0), math.rad(-10)), 0.4)
  364. LW.C0 = clerp(LW.C0, cf(0, 0.7, -.5) * angles(math.rad(130), math.rad(50), math.rad(90)), 0.4)
  365. end
  366. deb = false
  367. end
  368. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement