Advertisement
lafur

Untitled

Aug 25th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.72 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--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. Tool0 = Instance.new("Tool")
  23. Script1 = Instance.new("Script")
  24. Part2 = Instance.new("Part")
  25. SpecialMesh3 = Instance.new("SpecialMesh")
  26. Sound4 = Instance.new("Sound")
  27. Sound5 = Instance.new("Sound")
  28. Sound6 = Instance.new("Sound")
  29. Fire7 = Instance.new("Fire")
  30. LocalScript8 = Instance.new("LocalScript")
  31. Tool0.Name = "Joel's Flaming Super Death Sword"
  32. Tool0.Parent = mas
  33. Tool0.TextureId = "http://www.roblox.com/asset/?id=11444089"
  34. Tool0.GripForward = Vector3.new(-1, -0, -0)
  35. Tool0.GripPos = Vector3.new(0, 0, -1.70000005)
  36. Tool0.GripRight = Vector3.new(0, 1, 0)
  37. Tool0.GripUp = Vector3.new(0, 0, 1)
  38. Tool0.ToolTip = "Joel? Have you been downloading viruses again?"
  39. Script1.Name = "SwordScript"
  40. Script1.Parent = Tool0
  41. table.insert(cors,sandbox(Script1,function()
  42. -------- OMG HAX
  43.  
  44. r = game:service("RunService")
  45.  
  46.  
  47. local damage = 10
  48.  
  49.  
  50. local slash_damage = 25
  51. local lunge_damage = 50
  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 blow(hit)
  74. local humanoid = hit.Parent:findFirstChild("Humanoid")
  75. local vCharacter = Tool.Parent
  76. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  77. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  78. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  79. -- final check, make sure sword is in-hand
  80.  
  81. local right_arm = vCharacter:FindFirstChild("Right Arm")
  82. if (right_arm ~= nil) then
  83. local joint = right_arm:FindFirstChild("RightGrip")
  84. if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
  85. tagHumanoid(humanoid, vPlayer)
  86. humanoid:TakeDamage(damage)
  87. wait(1)
  88. untagHumanoid(humanoid)
  89. end
  90. end
  91.  
  92.  
  93. end
  94. end
  95.  
  96.  
  97. function tagHumanoid(humanoid, player)
  98. local creator_tag = Instance.new("ObjectValue")
  99. creator_tag.Value = player
  100. creator_tag.Name = "creator"
  101. creator_tag.Parent = humanoid
  102. end
  103.  
  104. function untagHumanoid(humanoid)
  105. if humanoid ~= nil then
  106. local tag = humanoid:findFirstChild("creator")
  107. if tag ~= nil then
  108. tag.Parent = nil
  109. end
  110. end
  111. end
  112.  
  113.  
  114. function attack()
  115. damage = slash_damage
  116. SlashSound:play()
  117. local anim = Instance.new("StringValue")
  118. anim.Name = "toolanim"
  119. anim.Value = "Slash"
  120. anim.Parent = Tool
  121. end
  122.  
  123. function lunge()
  124. damage = lunge_damage
  125.  
  126. LungeSound:play()
  127.  
  128. local anim = Instance.new("StringValue")
  129. anim.Name = "toolanim"
  130. anim.Value = "Lunge"
  131. anim.Parent = Tool
  132.  
  133.  
  134. force = Instance.new("BodyVelocity")
  135. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  136. force.Parent = Tool.Parent.Torso
  137. wait(.2)
  138. swordOut()
  139. wait(.2)
  140. force.Parent = nil
  141. wait(.4)
  142. swordUp()
  143.  
  144. damage = slash_damage
  145. end
  146.  
  147. function swordUp()
  148. Tool.GripForward = Vector3.new(-1,0,0)
  149. Tool.GripRight = Vector3.new(0,1,0)
  150. Tool.GripUp = Vector3.new(0,0,1)
  151. end
  152.  
  153. function swordOut()
  154. Tool.GripForward = Vector3.new(0,0,1)
  155. Tool.GripRight = Vector3.new(0,1,0)
  156. Tool.GripUp = Vector3.new(1,0,0)
  157. end
  158.  
  159. function swordAcross()
  160. -- parry
  161. end
  162.  
  163.  
  164. Tool.Enabled = true
  165. local last_attack = 0
  166. function onActivated()
  167.  
  168. if not Tool.Enabled then
  169. return
  170. end
  171.  
  172. Tool.Enabled = false
  173.  
  174. local character = Tool.Parent;
  175. local humanoid = character.Humanoid
  176. if humanoid == nil then
  177. print("Humanoid not found")
  178. return
  179. end
  180.  
  181. t = r.Stepped:wait()
  182.  
  183. if (t - last_attack < .2) then
  184. lunge()
  185. else
  186. attack()
  187. end
  188.  
  189. last_attack = t
  190.  
  191. --wait(.5)
  192.  
  193. Tool.Enabled = true
  194. end
  195.  
  196.  
  197. function onEquipped()
  198. UnsheathSound:play()
  199. end
  200.  
  201.  
  202. script.Parent.Activated:connect(onActivated)
  203. script.Parent.Equipped:connect(onEquipped)
  204.  
  205.  
  206. connection = sword.Touched:connect(blow)
  207.  
  208.  
  209.  
  210. end))
  211. Part2.Name = "Handle"
  212. Part2.Parent = Tool0
  213. Part2.BrickColor = BrickColor.new("Dark stone grey")
  214. Part2.Reflectance = 0.40000000596046
  215. Part2.Rotation = Vector3.new(-90, 0, 89.9599991)
  216. Part2.FormFactor = Enum.FormFactor.Plate
  217. Part2.Size = Vector3.new(1, 0.800000012, 5)
  218. Part2.CFrame = CFrame.new(-4.40033627, 2.5, 1.49973083, 0.000673112052, -0.999999762, -5.82076609e-11, 7.12051502e-08, 3.19377025e-11, 1, -0.999999762, -0.000673112052, 4.74638355e-08)
  219. Part2.BottomSurface = Enum.SurfaceType.Smooth
  220. Part2.TopSurface = Enum.SurfaceType.Smooth
  221. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  222. Part2.Position = Vector3.new(-4.40033627, 2.5, 1.49973083)
  223. Part2.Orientation = Vector3.new(-90, 89.9599991, 0)
  224. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  225. SpecialMesh3.Parent = Part2
  226. SpecialMesh3.MeshId = "http://www.roblox.com/asset/?id=11442510"
  227. SpecialMesh3.Scale = Vector3.new(1.70000005, 1.70000005, 1.70000005)
  228. SpecialMesh3.TextureId = "http://www.roblox.com/asset/?id=236171900"
  229. SpecialMesh3.MeshType = Enum.MeshType.FileMesh
  230. SpecialMesh3.Scale = Vector3.new(1.70000005, 1.70000005, 1.70000005)
  231. Sound4.Parent = Part2
  232. Sound4.SoundId = "rbxasset://sounds/swordslash.wav"
  233. Sound4.Volume = 0.69999998807907
  234. Sound5.Parent = Part2
  235. Sound5.SoundId = "rbxasset://sounds/swordlunge.wav"
  236. Sound5.Volume = 0.60000002384186
  237. Sound6.Parent = Part2
  238. Sound6.SoundId = "rbxasset://sounds/unsheath.wav"
  239. Sound6.Volume = 1
  240. Fire7.Parent = Part2
  241. Fire7.Heat = 7
  242. LocalScript8.Name = "Local Gui"
  243. LocalScript8.Parent = Tool0
  244. for i,v in pairs(mas:GetChildren()) do
  245. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  246. pcall(function() v:MakeJoints() end)
  247. end
  248. mas:Destroy()
  249. for i,v in pairs(cors) do
  250. spawn(function()
  251. pcall(v)
  252. end)
  253. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement