Advertisement
Hermaxs

Untitled

Nov 14th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.20 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,Mouse,mouse,UserInputService,ContextActionService = owner
  4. local RealPlayer = Player
  5. do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  6.  
  7.  
  8. --]]
  9. wait(1 / 60)
  10. Effects = { }
  11. local Player = game.Players.localPlayer
  12. local Character = Player.Character
  13. local Humanoid = Character.Humanoid
  14. local mouse = Player:GetMouse()
  15. local LeftArm = Character["Left Arm"]
  16. local RightArm = Character["Right Arm"]
  17. local LeftLeg = Character["Left Leg"]
  18. local RightLeg = Character["Right Leg"]
  19. local Head = Character.Head
  20. local Torso = Character.Torso
  21. local cam = game.Workspace.CurrentCamera
  22. local RootPart = Character.HumanoidRootPart
  23. local RootJoint = RootPart.RootJoint
  24. local equipped = false
  25. local attack = false
  26. local Anim = 'Idle'
  27. local idle = 0
  28. local attacktype = 1
  29. local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude
  30. local velocity = RootPart.Velocity.y
  31. local sine = 0
  32. local change = 1
  33. local grabbed = false
  34. local cn = CFrame.new
  35. local mr = math.rad
  36. local angles = CFrame.Angles
  37. local ud = UDim2.new
  38. local c3 = Color3.new
  39. local autofind = false
  40. game.Players.LocalPlayer.Character.Sound:Destroy()
  41. local NeckCF = cn(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  42. Humanoid.Animator:Destroy()
  43. Character.Animate:Destroy()
  44. EFS = Instance.new("Sound")
  45. EFS.Parent = Torso
  46. EFS.SoundId = "rbxassetid://"
  47. EFS.Volume = 4
  48. EFS.Looped = false
  49. EFS:Play()
  50. EFS2 = Instance.new("Sound")
  51. EFS2.Parent = Torso
  52. EFS2.SoundId = "rbxassetid://177339878"
  53. EFS2.Volume = 0.2
  54. EFS2.Looped = true
  55. EFS2:Play()
  56. EFS3 = Instance.new("Sound")
  57. EFS3.Parent = Torso
  58. EFS3.SoundId = "rbxassetid://585364476"
  59. EFS3.Volume = 0.8
  60. EFS3.Looped = false
  61.  
  62.  
  63.  
  64. ATS = Instance.new("Sound")
  65. ATS.Parent = Torso
  66. ATS.SoundId = "rbxassetid://347611423"
  67. ATS.Volume = 2
  68. ATS.Looped = false
  69.  
  70.  
  71. ff = Instance.new("ForceField", game.Players.LocalPlayer.Character)
  72. ff.Visible = false
  73.  
  74.  
  75. Character.Humanoid.WalkSpeed = 3
  76.  
  77.  
  78.  
  79. local RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  80. local RHCF = CFrame.fromEulerAnglesXYZ(0, 1.6, 0)
  81. local LHCF = CFrame.fromEulerAnglesXYZ(0, -1.6, 0)
  82.  
  83. RSH, LSH = nil, nil
  84.  
  85. RW = Instance.new("Weld")
  86. LW = Instance.new("Weld")
  87.  
  88. RH = Torso["Right Hip"]
  89. LH = Torso["Left Hip"]
  90.  
  91. RSH = Torso["Right Shoulder"]
  92. LSH = Torso["Left Shoulder"]
  93.  
  94. RSH.Parent = nil
  95. LSH.Parent = nil
  96.  
  97. RW.Name = "RW"
  98. RW.Part0 = Torso
  99. RW.C0 = cn(1.5, 0.5, 0)
  100. RW.C1 = cn(0, 0.5, 0)
  101. RW.Part1 = RightArm
  102. RW.Parent = Torso
  103.  
  104. LW.Name = "LW"
  105. LW.Part0 = Torso
  106. LW.C0 = cn(-1.5, 0.5, 0)
  107. LW.C1 = cn(0, 0.5, 0)
  108. LW.Part1 = LeftArm
  109. LW.Parent = Torso
  110.  
  111. function clerp(a, b, t)
  112. local qa = {
  113. QuaternionFromCFrame(a)
  114. }
  115. local qb = {
  116. QuaternionFromCFrame(b)
  117. }
  118. local ax, ay, az = a.x, a.y, a.z
  119. local bx, by, bz = b.x, b.y, b.z
  120. local _t = 1 - t
  121. return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
  122. end
  123.  
  124. function QuaternionFromCFrame(cf)
  125. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  126. local trace = m00 + m11 + m22
  127. if trace > 0 then
  128. local s = math.sqrt(1 + trace)
  129. local recip = 0.5 / s
  130. return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
  131. else
  132. local i = 0
  133. if m11 > m00 then
  134. i = 1
  135. end
  136. if m22 > (i == 0 and m00 or m11) then
  137. i = 2
  138. end
  139. if i == 0 then
  140. local s = math.sqrt(m00 - m11 - m22 + 1)
  141. local recip = 0.5 / s
  142. return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
  143. elseif i == 1 then
  144. local s = math.sqrt(m11 - m22 - m00 + 1)
  145. local recip = 0.5 / s
  146. return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
  147. elseif i == 2 then
  148. local s = math.sqrt(m22 - m00 - m11 + 1)
  149. local recip = 0.5 / s
  150. return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
  151. end
  152. end
  153. end
  154.  
  155. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  156. local xs, ys, zs = x + x, y + y, z + z
  157. local wx, wy, wz = w * xs, w * ys, w * zs
  158. local xx = x * xs
  159. local xy = x * ys
  160. local xz = x * zs
  161. local yy = y * ys
  162. local yz = y * zs
  163. local zz = z * zs
  164. 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))
  165. end
  166.  
  167. function QuaternionSlerp(a, b, t)
  168. local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
  169. local startInterp, finishInterp;
  170. if cosTheta >= 0.0001 then
  171. if (1 - cosTheta) > 0.0001 then
  172. local theta = math.acos(cosTheta)
  173. local invSinTheta = 1 / math.sin(theta)
  174. startInterp = math.sin((1 - t) * theta) * invSinTheta
  175. finishInterp = math.sin(t * theta) * invSinTheta
  176. else
  177. startInterp = 1 - t
  178. finishInterp = t
  179. end
  180. else
  181. if (1 + cosTheta) > 0.0001 then
  182. local theta = math.acos(-cosTheta)
  183. local invSinTheta = 1 / math.sin(theta)
  184. startInterp = math.sin((t - 1) * theta) * invSinTheta
  185. finishInterp = math.sin(t * theta) * invSinTheta
  186. else
  187. startInterp = t - 1
  188. finishInterp = t
  189. end
  190. end
  191. 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
  192. end
  193.  
  194. function swait(num)
  195. if num == 0 or num == nil then
  196. game:service'RunService'.RenderStepped:wait(0)
  197. else
  198. for i = 0, num do
  199. game:service'RunService'.RenderStepped:wait(0)
  200. end
  201. end
  202. end
  203.  
  204. local RbxUtility = LoadLibrary("RbxUtility")
  205. local Create = RbxUtility.Create
  206.  
  207. function RemoveOutlines(part)
  208. part.TopSurface, part.BottomSurface, part.LeftSurface, part.RightSurface, part.FrontSurface, part.BackSurface = 10, 10, 10, 10, 10, 10
  209. end
  210.  
  211. function CreatePart(FormFactor, Parent, Material, Reflectance, Transparency, BColor, Name, Size)
  212. local Part = Create("Part"){
  213. formFactor = FormFactor,
  214. Parent = Parent,
  215. Reflectance = Reflectance,
  216. Transparency = Transparency,
  217. CanCollide = false,
  218. Locked = true,
  219. BrickColor = BrickColor.new(tostring(BColor)),
  220. Name = Name,
  221. Size = Size,
  222. Material = Material,
  223. }
  224. RemoveOutlines(Part)
  225. return Part
  226. end
  227.  
  228. function CreateMesh(Mesh, Part, MeshType, MeshId, OffSet, Scale)
  229. local Msh = Create(Mesh){
  230. Parent = Part,
  231. Offset = OffSet,
  232. Scale = Scale,
  233. }
  234. if Mesh == "SpecialMesh" then
  235. Msh.MeshType = MeshType
  236. Msh.MeshId = MeshId
  237. end
  238. return Msh
  239. end
  240.  
  241. function CreateWeld(Parent, Part0, Part1, C0, C1)
  242. local Weld = Create("Weld"){
  243. Parent = Parent,
  244. Part0 = Part0,
  245. Part1 = Part1,
  246. C0 = C0,
  247. C1 = C1,
  248. }
  249. return Weld
  250. end
  251.  
  252. function rayCast(Position, Direction, Range, Ignore)
  253. return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore)
  254. end
  255.  
  256. function CreateSound(id, par, vol, pit)
  257. coroutine.resume(coroutine.create(function()
  258. local sou = Instance.new("Sound", par or workspace)
  259. sou.Volume = vol
  260. sou.Pitch = pit or 1
  261. sou.SoundId = id
  262. wait()
  263. sou:play()
  264. game:GetService("Debris"):AddItem(sou, 6)
  265. end))
  266. end
  267.  
  268. local function getclosest(obj, distance)
  269. local last, lastx = distance + 1
  270. for i, v in pairs(workspace:GetChildren()) do
  271. if v:IsA'Model' and v ~= Character and v:findFirstChild('Humanoid') and v:findFirstChild('Torso') and v:findFirstChild('Humanoid').Health > 0 then
  272. local t = v.Torso
  273. local dist = (t.Position - obj.Position).magnitude
  274. if dist <= distance then
  275. if dist < last then
  276. last = dist
  277. lastx = v
  278. end
  279. end
  280. end
  281. end
  282. return lastx
  283. end
  284.  
  285. function Damage(hit, damage, cooldown, Color1, Color2, HSound, HPitch)
  286. for i, v in pairs(hit:GetChildren()) do
  287. if v:IsA("Humanoid") and hit.Name ~= Character.Name then
  288. local find = v:FindFirstChild("Hitz")
  289. if not find then
  290. if v.Parent:findFirstChild("Head") then
  291. local BillG = Create("BillboardGui"){
  292. Parent = v.Parent.Head,
  293. Size = UDim2.new(1, 0, 1, 0),
  294. Adornee = v.Parent.Head,
  295. StudsOffset = Vector3.new(math.random(-3, 3), math.random(3, 5), math.random(-3, 3)),
  296. }
  297. local TL = Create("TextLabel"){
  298. Parent = BillG,
  299. Size = UDim2.new(3, 3, 3, 3),
  300. BackgroundTransparency = 1,
  301. Text = tostring(damage).."-",
  302. TextColor3 = Color1.Color,
  303. TextStrokeColor3 = Color2.Color,
  304. TextStrokeTransparency = 0,
  305. TextXAlignment = Enum.TextXAlignment.Center,
  306. TextYAlignment = Enum.TextYAlignment.Center,
  307. FontSize = Enum.FontSize.Size18,
  308. Font = "ArialBold",
  309. }
  310. coroutine.resume(coroutine.create(function()
  311. wait(1)
  312. for i = 0, 1, .1 do
  313. wait(.1)
  314. BillG.StudsOffset = BillG.StudsOffset + Vector3.new(0, .1, 0)
  315. end
  316. BillG:Destroy()
  317. end))
  318. end
  319. v.Health = v.Health - damage
  320. local bool = Create("BoolValue"){
  321. Parent = v,
  322. Name = 'Hitz',
  323. }
  324. if HSound ~= nil and HPitch ~= nil then
  325. CreateSound(HSound, hit, 1, HPitch)
  326. end
  327. game:GetService("Debris"):AddItem(bool, cooldown)
  328. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement