Advertisement
lafur

Untitled

Jan 28th, 2019
204
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 print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end --Converted with ttyyuu12345's model to script plugin v4
  6. function sandbox(var,func)
  7. local env = getfenv(func)
  8. local newenv = setmetatable({},{
  9. __index = function(self,k)
  10. if k=="script" then
  11. return var
  12. else
  13. return env[k]
  14. end
  15. end,
  16. })
  17. setfenv(func,newenv)
  18. return func
  19. end
  20. cors = {}
  21. mas = Instance.new("Model",game:GetService("Lighting"))
  22. Script0 = Instance.new("Script")
  23. Script1 = Instance.new("Script")
  24. LocalScript2 = Instance.new("LocalScript")
  25. Part3 = Instance.new("Part")
  26. SpecialMesh4 = Instance.new("SpecialMesh")
  27. Sound5 = Instance.new("Sound")
  28. Tool6 = Instance.new("Tool")
  29. Part7 = Instance.new("Part")
  30. SpecialMesh8 = Instance.new("SpecialMesh")
  31. Sound9 = Instance.new("Sound")
  32. Script10 = Instance.new("Script")
  33. Script11 = Instance.new("Script")
  34. LocalScript12 = Instance.new("LocalScript")
  35. Script10.Name = "Destroy"
  36. Script10.Parent = Tool6
  37. table.insert(cors,sandbox(Script10,function()
  38.  
  39.  
  40. local Tool = script.Parent --make sure this is a Tool object
  41.  
  42. Tool.Equipped:connect(function(Mouse)
  43. Mouse.Button1Down:connect(function()
  44. script.Parent.Handle.Touched:connect(function(hit)
  45. hit.Transparency = 0
  46. for n = 1,40 do
  47. wait()
  48. hit.BrickColor = BrickColor.Random()
  49. end
  50.  
  51. wait()
  52. hit:Destroy()
  53. end)
  54. end)
  55. end)
  56.  
  57.  
  58.  
  59.  
  60.  
  61. end))
  62. Script11.Name = "Sword Script"
  63. Script11.Parent = Tool6
  64. table.insert(cors,sandbox(Script11,function()
  65. -------- OMG HAX
  66.  
  67. r = game:service("RunService")
  68.  
  69.  
  70. local damage = 10
  71.  
  72.  
  73. local slash_damage = 10
  74.  
  75. sword = script.Parent.Handle
  76. Tool = script.Parent
  77.  
  78.  
  79. local SlashSound = Instance.new("Sound")
  80. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  81. SlashSound.Parent = sword
  82. SlashSound.Volume = .7
  83.  
  84. local UnsheathSound = Instance.new("Sound")
  85. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  86. UnsheathSound.Parent = sword
  87. UnsheathSound.Volume = 1
  88.  
  89.  
  90.  
  91. function blow(hit)
  92. local humanoid = hit.Parent:findFirstChild("Humanoid")
  93. local vCharacter = Tool.Parent
  94. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  95. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  96. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  97.  
  98. tagHumanoid(humanoid, vPlayer)
  99. humanoid:TakeDamage(damage)
  100. wait(1)
  101. untagHumanoid(humanoid)
  102. end
  103. end
  104.  
  105.  
  106. function tagHumanoid(humanoid, player)
  107. local creator_tag = Instance.new("ObjectValue")
  108. creator_tag.Value = player
  109. creator_tag.Name = "creator"
  110. creator_tag.Parent = humanoid
  111. end
  112.  
  113. function untagHumanoid(humanoid)
  114. if humanoid ~= nil then
  115. local tag = humanoid:findFirstChild("creator")
  116. if tag ~= nil then
  117. tag.Parent = nil
  118. end
  119. end
  120. end
  121.  
  122.  
  123. function attack()
  124. damage = slash_damage
  125. SlashSound:play()
  126. local anim = Instance.new("StringValue")
  127. anim.Name = "toolanim"
  128. anim.Value = "Slash"
  129. anim.Parent = Tool
  130. end
  131.  
  132.  
  133. function swordUp()
  134. Tool.GripForward = Vector3.new(-1.1,0,0)
  135. Tool.GripRight = Vector3.new(0,1,0)
  136. Tool.GripUp = Vector3.new(0,0,1)
  137. end
  138.  
  139. function swordOut()
  140. Tool.GripForward = Vector3.new(0,0,1)
  141. Tool.GripRight = Vector3.new(0,-1,0)
  142. Tool.GripUp = Vector3.new(-1,0,0)
  143. end
  144.  
  145. function swordAcross()
  146. -- parry
  147. end
  148.  
  149.  
  150. Tool.Enabled = true
  151. local last_attack = 0
  152. function onActivated()
  153.  
  154. if not Tool.Enabled then
  155. return
  156. end
  157.  
  158. Tool.Enabled = false
  159.  
  160. local character = Tool.Parent;
  161. local humanoid = character.Humanoid
  162. if humanoid == nil then
  163. print("Humanoid not found")
  164. return
  165. end
  166.  
  167. t = r.Stepped:wait()
  168. attack()
  169. last_attack = t
  170.  
  171. --wait(.5)
  172.  
  173. Tool.Enabled = true
  174. end
  175.  
  176.  
  177. function onEquipped()
  178. UnsheathSound:play()
  179. end
  180.  
  181.  
  182. script.Parent.Activated:connect(onActivated)
  183. script.Parent.Equipped:connect(onEquipped)
  184.  
  185.  
  186. connection = sword.Touched:connect(blow)
  187.  
  188.  
  189.  
  190. end))
  191. LocalScript12.Name = "Local Gui"
  192. LocalScript12.Parent = Tool6
  193. Part7.Name = "Handle"
  194. Part7.Parent = Tool6
  195. Part7.BrickColor = BrickColor.new("Dark stone grey")
  196. Part7.Reflectance = 0.40000000596046
  197. Part7.Rotation = Vector3.new(-90.0299988, -0.0399999991, -35.3699989)
  198. Part7.Locked = true
  199. Part7.FormFactor = Enum.FormFactor.Plate
  200. Part7.Size = Vector3.new(1, 0.800000012, 3)
  201. Part7.CFrame = CFrame.new(-1567.85327, 1.50039995, -2444.01294, 0.815435171, 0.578847528, -0.000649310299, 0.000796274282, -3.93885717e-21, 0.999999642, 0.578847408, -0.81543535, -0.000460921437)
  202. Part7.BottomSurface = Enum.SurfaceType.Smooth
  203. Part7.TopSurface = Enum.SurfaceType.Smooth
  204. Part7.Color = Color3.new(0.388235, 0.372549, 0.384314)
  205. Part7.Position = Vector3.new(-1567.85327, 1.50039995, -2444.01294)
  206. Part7.Orientation = Vector3.new(-89.9499969, -125.369995, 90)
  207. Part7.Color = Color3.new(0.388235, 0.372549, 0.384314)
  208. SpecialMesh8.Parent = Part7
  209. SpecialMesh8.MeshId = "http://www.roblox.com/asset/?id=16198309"
  210. SpecialMesh8.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  211. SpecialMesh8.TextureId = "http://www.roblox.com/asset/?id=16198294"
  212. SpecialMesh8.MeshType = Enum.MeshType.FileMesh
  213. SpecialMesh8.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  214. Sound9.Parent = Part7
  215. Sound9.SoundId = "http://www.roblox.com/Asset/?ID=12135982"
  216. Sound9.Volume = 0.69999998807907
  217. Tool6.Name = "DeleteTool"
  218. Tool6.Parent = mas
  219. Tool6.TextureId = "http://www.roblox.com/asset?id=73241901"
  220. Tool6.GripForward = Vector3.new(-1, -0, -0)
  221. Tool6.GripPos = Vector3.new(0, 0, -0.5)
  222. Tool6.GripRight = Vector3.new(0, 1, 0)
  223. Tool6.GripUp = Vector3.new(0, 0, 1)
  224. Tool6.ToolTip = "Delete"
  225. Part7.Name = "Handle"
  226. Part7.Parent = Tool6
  227. Part7.BrickColor = BrickColor.new("Dark stone grey")
  228. Part7.Reflectance = 0.40000000596046
  229. Part7.Rotation = Vector3.new(-90.0299988, -0.0399999991, -35.3699989)
  230. Part7.Locked = true
  231. Part7.FormFactor = Enum.FormFactor.Plate
  232. Part7.Size = Vector3.new(1, 0.800000012, 3)
  233. Part7.CFrame = CFrame.new(-1567.85327, 1.50039995, -2444.01294, 0.815435171, 0.578847528, -0.000649310299, 0.000796274282, -3.93885717e-21, 0.999999642, 0.578847408, -0.81543535, -0.000460921437)
  234. Part7.BottomSurface = Enum.SurfaceType.Smooth
  235. Part7.TopSurface = Enum.SurfaceType.Smooth
  236. Part7.Color = Color3.new(0.388235, 0.372549, 0.384314)
  237. Part7.Position = Vector3.new(-1567.85327, 1.50039995, -2444.01294)
  238. Part7.Orientation = Vector3.new(-89.9499969, -125.369995, 90)
  239. Part7.Color = Color3.new(0.388235, 0.372549, 0.384314)
  240. SpecialMesh8.Parent = Part7
  241. SpecialMesh8.MeshId = "http://www.roblox.com/asset/?id=16198309"
  242. SpecialMesh8.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  243. SpecialMesh8.TextureId = "http://www.roblox.com/asset/?id=16198294"
  244. SpecialMesh8.MeshType = Enum.MeshType.FileMesh
  245. SpecialMesh8.Scale = Vector3.new(1.20000005, 1.20000005, 1.20000005)
  246. Sound9.Parent = Part7
  247. Sound9.SoundId = "http://www.roblox.com/Asset/?ID=12135982"
  248. Sound9.Volume = 0.69999998807907
  249. Script10.Name = "Destroy"
  250. Script10.Parent = Tool6
  251. table.insert(cors,sandbox(Script10,function()
  252. script.Parent.Activated:connect(function(mouse)
  253.  
  254. mouse.KeyUp:connect(function()
  255.  
  256. script.Parent.Handle.Touched:connect(function(hit)
  257. hit.Transparency = 0
  258. for n = 1,40 do
  259. wait()
  260. hit.BrickColor = BrickColor.Random()
  261. end
  262.  
  263. wait()
  264. hit:Destroy()
  265. end)
  266.  
  267. end)
  268.  
  269. end)
  270.  
  271.  
  272.  
  273. end))
  274. Script11.Name = "Sword Script"
  275. Script11.Parent = Tool6
  276. table.insert(cors,sandbox(Script11,function()
  277. -------- OMG HAX
  278.  
  279. r = game:service("RunService")
  280.  
  281.  
  282. local damage = 10
  283.  
  284.  
  285. local slash_damage = 10
  286.  
  287. sword = script.Parent.Handle
  288. Tool = script.Parent
  289.  
  290.  
  291. local SlashSound = Instance.new("Sound")
  292. SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  293. SlashSound.Parent = sword
  294. SlashSound.Volume = .7
  295.  
  296. local UnsheathSound = Instance.new("Sound")
  297. UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
  298. UnsheathSound.Parent = sword
  299. UnsheathSound.Volume = 1
  300.  
  301.  
  302.  
  303. function blow(hit)
  304. local humanoid = hit.Parent:findFirstChild("Humanoid")
  305. local vCharacter = Tool.Parent
  306. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  307. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  308. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  309.  
  310. tagHumanoid(humanoid, vPlayer)
  311. humanoid:TakeDamage(damage)
  312. wait(1)
  313. untagHumanoid(humanoid)
  314. end
  315. end
  316.  
  317.  
  318. function tagHumanoid(humanoid, player)
  319. local creator_tag = Instance.new("ObjectValue")
  320. creator_tag.Value = player
  321. creator_tag.Name = "creator"
  322. creator_tag.Parent = humanoid
  323. end
  324.  
  325. function untagHumanoid(humanoid)
  326. if humanoid ~= nil then
  327. local tag = humanoid:findFirstChild("creator")
  328. if tag ~= nil then
  329. tag.Parent = nil
  330. end
  331. end
  332. end
  333.  
  334.  
  335. function attack()
  336. damage = slash_damage
  337. SlashSound:play()
  338. local anim = Instance.new("StringValue")
  339. anim.Name = "toolanim"
  340. anim.Value = "Slash"
  341. anim.Parent = Tool
  342. end
  343.  
  344.  
  345. function swordUp()
  346. Tool.GripForward = Vector3.new(-1.1,0,0)
  347. Tool.GripRight = Vector3.new(0,1,0)
  348. Tool.GripUp = Vector3.new(0,0,1)
  349. end
  350.  
  351. function swordOut()
  352. Tool.GripForward = Vector3.new(0,0,1)
  353. Tool.GripRight = Vector3.new(0,-1,0)
  354. Tool.GripUp = Vector3.new(-1,0,0)
  355. end
  356.  
  357. function swordAcross()
  358. -- parry
  359. end
  360.  
  361.  
  362. Tool.Enabled = true
  363. local last_attack = 0
  364. function onActivated()
  365.  
  366. if not Tool.Enabled then
  367. return
  368. end
  369.  
  370. Tool.Enabled = false
  371.  
  372. local character = Tool.Parent;
  373. local humanoid = character.Humanoid
  374. if humanoid == nil then
  375. print("Humanoid not found")
  376. return
  377. end
  378.  
  379. t = r.Stepped:wait()
  380. attack()
  381. last_attack = t
  382.  
  383. --wait(.5)
  384.  
  385. Tool.Enabled = true
  386. end
  387.  
  388.  
  389. function onEquipped()
  390. UnsheathSound:play()
  391. end
  392.  
  393.  
  394. script.Parent.Activated:connect(onActivated)
  395. script.Parent.Equipped:connect(onEquipped)
  396.  
  397.  
  398. connection = sword.Touched:connect(blow)
  399.  
  400.  
  401.  
  402. end))
  403. LocalScript12.Name = "Local Gui"
  404. LocalScript12.Parent = Tool6
  405. for i,v in pairs(mas:GetChildren()) do
  406. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  407. pcall(function() v:MakeJoints() end)
  408. end
  409. mas:Destroy()
  410. for i,v in pairs(cors) do
  411. spawn(function()
  412. pcall(v)
  413. end)
  414. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement