Advertisement
gecksad

Untitled

Dec 24th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --]]
  2. --https://github.com/Mokiros/roblox-FE-compatibility
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  5. local RealPlayer = Player
  6. 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
  7.  
  8. --Made by N3xul
  9. local runDummyScript = function(f,scri)
  10. local oldenv = getfenv(f)
  11. local newenv = setmetatable({}, {
  12. __index = function(_, k)
  13. if k:lower() == 'script' then
  14. return scri
  15. else
  16. return oldenv[k]
  17. end
  18. end
  19. })
  20. setfenv(f, newenv)
  21. ypcall(function() f() end)
  22. end
  23. cors = {}
  24. mas = Instance.new("Model",game:GetService("Lighting"))
  25. mas.Name = "CompiledModel"
  26. o1 = Instance.new("Tool")
  27. o2 = Instance.new("Script")
  28. o3 = Instance.new("Part")
  29. o4 = Instance.new("SpecialMesh")
  30. o6 = Instance.new("LocalScript")
  31. o1.Name = "Windforce"
  32. o1.Parent = mas
  33. o1.GripForward = Vector3.new(-1, -0, -0)
  34. o1.GripPos = Vector3.new(0, 0, -1.75)
  35. o1.GripRight = Vector3.new(0, 1, 0)
  36. o1.GripUp = Vector3.new(0, 0, 1)
  37. o2.Name = "SwordScript"
  38. o2.Parent = o1
  39. table.insert(cors,coroutine.create(function()
  40. wait()
  41. runDummyScript(function()
  42. -------- OMG HAX
  43.  
  44. r = game:service("RunService")
  45.  
  46.  
  47. local damage = 10
  48.  
  49.  
  50. local slash_damage = 18
  51. local lunge_damage = 36
  52.  
  53. sword = script.Parent.Handle
  54. Tool = script.Parent
  55.  
  56.  
  57. local SlashSound = Instance.new("Sound")
  58. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  59. SlashSound.Parent = sword
  60. SlashSound.Volume = .7
  61.  
  62. local LungeSound = Instance.new("Sound")
  63. LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
  64. LungeSound.Parent = sword
  65. LungeSound.Volume = .6
  66.  
  67. local UnsheathSound = Instance.new("Sound")
  68. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  69. UnsheathSound.Parent = sword
  70. UnsheathSound.Volume = 1
  71.  
  72.  
  73. function windforce(dir, victimTorso)
  74.     if (victimTorso.Parent:FindFirstChild("ForceField") ~= nil) then return end
  75.     if victimTorso:FindFirstChild("WindEffect") == nil then
  76.         local force = Instance.new("BodyVelocity")
  77.         force.Name = "WindEffect"
  78.         force.maxForce = Vector3.new(1e7, 1e7, 1e7)
  79.         force.P = 125
  80.         force.velocity =  (dir * 150) + Vector3.new(0, 30,0)
  81.         force.Parent = victimTorso
  82.  
  83.  
  84.         game.Debris:AddItem(force, .25)
  85.  
  86.    
  87.     end
  88. end
  89.  
  90.  
  91.  
  92. function blow(hit)
  93.     local humanoid = hit.Parent:findFirstChild("Humanoid")
  94.     local vCharacter = Tool.Parent
  95.     local vPlayer = game.Players:playerFromCharacter(vCharacter)
  96.     local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  97.     if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  98.         -- final check, make sure sword is in-hand
  99.  
  100.         local right_arm = vCharacter:FindFirstChild("Right Arm")
  101.         if (right_arm ~= nil) then
  102.             local joint = right_arm:FindFirstChild("RightGrip")
  103.             if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  104.                 tagHumanoid(humanoid, vPlayer)
  105.                 humanoid:TakeDamage(damage)
  106.                 local d = vCharacter.Torso.CFrame.lookVector
  107.                 windforce(Vector3.new(d.x, d.y, d.z), hit.Parent.Torso)
  108.             end
  109.         end
  110.  
  111.  
  112.     end
  113. end
  114.  
  115.  
  116.  
  117. function tagHumanoid(humanoid, player)
  118.     local creator_tag = Instance.new("ObjectValue")
  119.     creator_tag.Value = player
  120.     creator_tag.Name = "creator"
  121.     creator_tag.Parent = humanoid
  122.     game.Debris:AddItem(creator_tag, 1)
  123. end
  124.  
  125. function untagHumanoid(humanoid)
  126.     if humanoid ~= nil then
  127.         local tag = humanoid:findFirstChild("creator")
  128.         if tag ~= nil then
  129.             tag.Parent = nil
  130.         end
  131.     end
  132. end
  133.  
  134.  
  135. function attack()
  136.     damage = slash_damage
  137.     SlashSound:play()
  138.     local anim = Instance.new("StringValue")
  139.     anim.Name = "toolanim"
  140.     anim.Value = "Slash"
  141.     anim.Parent = Tool
  142. end
  143.  
  144. function lunge()
  145.     damage = lunge_damage
  146.  
  147.     LungeSound:play()
  148.  
  149.     local anim = Instance.new("StringValue")
  150.     anim.Name = "toolanim"
  151.     anim.Value = "Lunge"
  152.     anim.Parent = Tool
  153.    
  154.    
  155.     local force = Instance.new("BodyVelocity")
  156.     force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  157.     force.Parent = Tool.Parent.Torso
  158.     wait(.25)
  159.     swordOut()
  160.     wait(.25)
  161.     force.Parent = nil
  162.     wait(.5)
  163.     swordUp()
  164.  
  165.     damage = slash_damage
  166. end
  167.  
  168. function swordUp()
  169.     Tool.GripForward = Vector3.new(-1,0,0)
  170.     Tool.GripRight = Vector3.new(0,1,0)
  171.     Tool.GripUp = Vector3.new(0,0,1)
  172. end
  173.  
  174. function swordOut()
  175.     Tool.GripForward = Vector3.new(0,0,1)
  176.     Tool.GripRight = Vector3.new(0,-1,0)
  177.     Tool.GripUp = Vector3.new(-1,0,0)
  178. end
  179.  
  180. function swordAcross()
  181.     -- parry
  182. end
  183.  
  184.  
  185. Tool.Enabled = true
  186. local last_attack = 0
  187. function onActivated()
  188.  
  189.     if not Tool.Enabled then
  190.         return
  191.     end
  192.  
  193.     Tool.Enabled = false
  194.  
  195.     local character = Tool.Parent;
  196.     local humanoid = character.Humanoid
  197.     if humanoid == nil then
  198.         print("Humanoid not found")
  199.         return
  200.     end
  201.  
  202.     t = r.Stepped:wait()
  203.  
  204.     if (t - last_attack < .2) then
  205.         lunge()
  206.     else
  207.         attack()
  208.     end
  209.  
  210.     last_attack = t
  211.  
  212.     --wait(.5)
  213.  
  214.     Tool.Enabled = true
  215. end
  216.  
  217.  
  218. function onEquipped()
  219.     UnsheathSound:play()
  220. end
  221.  
  222.  
  223. script.Parent.Activated:connect(onActivated)
  224. script.Parent.Equipped:connect(onEquipped)
  225.  
  226.  
  227. connection = sword.Touched:connect(blow)
  228.  
  229.  
  230.  
  231. end,o2)
  232. end))
  233. o3.Name = "Handle"
  234. o3.Parent = o1
  235. o3.BrickColor = BrickColor.new("Medium blue")
  236. o3.Reflectance = 0.30000001192093
  237. o3.Position = Vector3.new(48.0999985, 2.50000191, 149.800018)
  238. o3.Rotation = Vector3.new(90, -0, -0)
  239. o3.FormFactor = Enum.FormFactor.Plate
  240. o3.Size = Vector3.new(1, 0.800000012, 5)
  241. o3.CFrame = CFrame.new(48.0999985, 2.50000191, 149.800018, 1, 0, -0, 0, 0, -1, 0, 1, -0)
  242. o3.BottomSurface = Enum.SurfaceType.Smooth
  243. o3.TopSurface = Enum.SurfaceType.Smooth
  244. o3.Color = Color3.new(0.431373, 0.6, 0.792157)
  245. o3.Position = Vector3.new(48.0999985, 2.50000191, 149.800018)
  246. o4.Parent = o3
  247. o4.MeshId = "rbxasset://fonts/sword.mesh"
  248. o4.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  249. o4.VertexColor = Vector3.new(1, 1, 0)
  250. o4.MeshType = Enum.MeshType.FileMesh
  251. o6.Name = "Local Gui"
  252. o6.Parent = o1
  253. table.insert(cors,coroutine.create(function()
  254. wait()
  255. runDummyScript(function()
  256. local Tool = script.Parent;
  257.  
  258. enabled = true
  259. function onButton1Down(mouse)
  260.     if not enabled then
  261.         return
  262.     end
  263.  
  264.     enabled = false
  265.     mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  266.  
  267.     wait(.5)
  268.     mouse.Icon = "rbxasset://textures\\GunCursor.png"
  269.     enabled = true
  270.  
  271. end
  272.  
  273. function onEquippedLocal(mouse)
  274.  
  275.     if mouse == nil then
  276.         print("Mouse not found")
  277.         return
  278.     end
  279.  
  280.     mouse.Icon = "rbxasset://textures\\GunCursor.png"
  281.     mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  282. end
  283.  
  284.  
  285. Tool.Equipped:connect(onEquippedLocal)
  286.  
  287. end,o6)
  288. end))
  289. mas.Parent = workspace
  290. mas:MakeJoints()
  291. local mas1 = mas:GetChildren()
  292. for i=1,#mas1 do
  293.     mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  294.     ypcall(function() mas1[i]:MakeJoints() end)
  295. end
  296. mas:Destroy()
  297. for i=1,#cors do
  298. coroutine.resume(cors[i])
  299. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement