Advertisement
Josemmoya

unana

Mar 26th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.78 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86. --Converted with ttyyuu12345's model to script plugin v4
  87. function sandbox(var,func)
  88. local env = getfenv(func)
  89. local newenv = setmetatable({},{
  90. __index = function(self,k)
  91. if k=="script" then
  92. return var
  93. else
  94. return env[k]
  95. end
  96. end,
  97. })
  98. setfenv(func,newenv)
  99. return func
  100. end
  101. cors = {}
  102. mas = Instance.new("Model",game:GetService("Lighting"))
  103. Tool0 = Instance.new("Tool")
  104. Part1 = Instance.new("Part")
  105. SpecialMesh2 = Instance.new("SpecialMesh")
  106. Sound3 = Instance.new("Sound")
  107. Sound4 = Instance.new("Sound")
  108. Sound5 = Instance.new("Sound")
  109. Sparkles6 = Instance.new("Sparkles")
  110. Sparkles7 = Instance.new("Sparkles")
  111. SpotLight8 = Instance.new("SpotLight")
  112. SpotLight9 = Instance.new("SpotLight")
  113. Script10 = Instance.new("Script")
  114. LocalScript11 = Instance.new("LocalScript")
  115. Tool0.Name = "EpicKatana"
  116. Tool0.Parent = mas
  117. Tool0.TextureId = "http://www.roblox.com/asset/?id=25265469"
  118. Tool0.GripForward = Vector3.new(-1, -0, -0)
  119. Tool0.GripPos = Vector3.new(0, 0, -1.70000005)
  120. Tool0.GripRight = Vector3.new(0, 1, 0)
  121. Tool0.GripUp = Vector3.new(0, 0, 1)
  122. Part1.Name = "Handle"
  123. Part1.Parent = Tool0
  124. Part1.BrickColor = BrickColor.new("Dark stone grey")
  125. Part1.Rotation = Vector3.new(-48.3999977, 18.9499989, 110.119995)
  126. Part1.Locked = true
  127. Part1.FormFactor = Enum.FormFactor.Custom
  128. Part1.Size = Vector3.new(1, 0.800000012, 5)
  129. Part1.CFrame = CFrame.new(-0.0445830002, 16.590107, 0.405761003, -0.32535699, -0.888061285, 0.324792504, 0.706910312, -0.000305632973, 0.707303107, -0.628029346, 0.459725142, 0.627879083)
  130. Part1.BottomSurface = Enum.SurfaceType.Smooth
  131. Part1.TopSurface = Enum.SurfaceType.Smooth
  132. Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
  133. Part1.Position = Vector3.new(-0.0445830002, 16.590107, 0.405761003)
  134. Part1.Orientation = Vector3.new(-45.0200005, 27.3499985, 90.0199966)
  135. Part1.Color = Color3.new(0.388235, 0.372549, 0.384314)
  136. SpecialMesh2.Parent = Part1
  137. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=11442510"
  138. SpecialMesh2.Scale = Vector3.new(1.70000005, 1.70000005, 1.70000005)
  139. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=11442524"
  140. SpecialMesh2.VertexColor = Vector3.new(0, 0, 0)
  141. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  142. SpecialMesh2.Scale = Vector3.new(1.70000005, 1.70000005, 1.70000005)
  143. Sound3.Name = "SwordLunge"
  144. Sound3.Parent = Part1
  145. Sound3.SoundId = "http://www.roblox.com/asset/?id=25256253"
  146. Sound3.Volume = 0.80000001192093
  147. Sound4.Name = "SwordSlash"
  148. Sound4.Parent = Part1
  149. Sound4.SoundId = "http://www.roblox.com/asset/?id=12222216"
  150. Sound4.Volume = 0.69999998807907
  151. Sound5.Name = "Unsheath"
  152. Sound5.Parent = Part1
  153. Sound5.SoundId = "http://www.roblox.com/asset/?id=12222225"
  154. Sound5.Volume = 1
  155. Sparkles6.Name = "Sparkles1"
  156. Sparkles6.Parent = Part1
  157. Sparkles6.Color = Color3.new(-5.3125, -40.8, 6)
  158. Sparkles6.SparkleColor = Color3.new(-3, -4, 6)
  159. Sparkles6.Color = Color3.new(-5.3125, -40.8, 6)
  160. Sparkles7.Name = "Sparkles2"
  161. Sparkles7.Parent = Part1
  162. Sparkles7.Color = Color3.new(7.08333, -10.2, 5)
  163. Sparkles7.SparkleColor = Color3.new(4, -1, 5)
  164. Sparkles7.Color = Color3.new(7.08333, -10.2, 5)
  165. SpotLight8.Name = "Light1"
  166. SpotLight8.Parent = Part1
  167. SpotLight8.Color = Color3.new(-3, -4, 6)
  168. SpotLight8.Brightness = 6
  169. SpotLight8.Range = 6
  170. SpotLight8.Angle = 180
  171. SpotLight8.Face = Enum.NormalId.Top
  172. SpotLight8.Color = Color3.new(-3, -4, 6)
  173. SpotLight9.Name = "Light2"
  174. SpotLight9.Parent = Part1
  175. SpotLight9.Color = Color3.new(4, -1, 5)
  176. SpotLight9.Brightness = 6
  177. SpotLight9.Range = 6
  178. SpotLight9.Angle = 180
  179. SpotLight9.Face = Enum.NormalId.Bottom
  180. SpotLight9.Color = Color3.new(4, -1, 5)
  181. Script10.Name = "SwordScript"
  182. Script10.Parent = Tool0
  183. table.insert(cors,sandbox(Script10,function()
  184. --Rescripted by Luckymaxer
  185.  
  186. Tool = script.Parent
  187. Handle = Tool:WaitForChild("Handle")
  188.  
  189. Sparkles1 = Handle:WaitForChild("Sparkles1")
  190. Sparkles2 = Handle:WaitForChild("Sparkles2")
  191. Light1 = Handle:WaitForChild("Light1")
  192. Light2 = Handle:WaitForChild("Light2")
  193.  
  194. Players = game:GetService("Players")
  195. Debris = game:GetService("Debris")
  196. RunService = game:GetService("RunService")
  197.  
  198. DamageValues = {
  199. BaseDamage = 15,
  200. SlashDamage = 30,
  201. LungeDamage = 42
  202. }
  203.  
  204. NormalSpeed = 16
  205. RegularSpeed = (NormalSpeed + 2)
  206.  
  207. Damage = DamageValues.BaseDamage
  208.  
  209. Grips = {
  210. Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
  211. Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
  212. }
  213.  
  214. Sounds = {
  215. Slash = Handle:WaitForChild("SwordSlash"),
  216. Lunge = Handle:WaitForChild("SwordLunge"),
  217. Unsheath = Handle:WaitForChild("Unsheath")
  218. }
  219.  
  220. ToolEquipped = false
  221.  
  222. Tool.Grip = Grips.Up
  223. Tool.Enabled = true
  224.  
  225. function IsTeamMate(Player1, Player2)
  226. return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
  227. end
  228.  
  229. function TagHumanoid(humanoid, player)
  230. local Creator_Tag = Instance.new("ObjectValue")
  231. Creator_Tag.Name = "creator"
  232. Creator_Tag.Value = player
  233. Debris:AddItem(Creator_Tag, 2)
  234. Creator_Tag.Parent = humanoid
  235. end
  236.  
  237. function UntagHumanoid(humanoid)
  238. for i, v in pairs(humanoid:GetChildren()) do
  239. if v:IsA("ObjectValue") and v.Name == "creator" then
  240. v:Destroy()
  241. end
  242. end
  243. end
  244.  
  245. function Blow(Hit)
  246. if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
  247. return
  248. end
  249. local RightArm = Character:FindFirstChild("Right Arm")
  250. if not RightArm then
  251. return
  252. end
  253. local RightGrip = RightArm:FindFirstChild("RightGrip")
  254. if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
  255. return
  256. end
  257. local character = Hit.Parent
  258. if character == Character then
  259. return
  260. end
  261. local humanoid = character:FindFirstChild("Humanoid")
  262. if not humanoid or humanoid.Health == 0 then
  263. return
  264. end
  265. local player = Players:GetPlayerFromCharacter(character)
  266. if player and (player == Player or IsTeamMate(Player, player)) then
  267. return
  268. end
  269. UntagHumanoid(humanoid)
  270. TagHumanoid(humanoid, Player)
  271. humanoid:TakeDamage(Damage)
  272. end
  273.  
  274.  
  275. function Attack()
  276. Damage = DamageValues.SlashDamage
  277. Sounds.Slash:Play()
  278. local Anim = Instance.new("StringValue")
  279. Anim.Name = "toolanim"
  280. Anim.Value = "Slash"
  281. Anim.Parent = Tool
  282. end
  283.  
  284. function Lunge()
  285. Damage = DamageValues.LungeDamage
  286.  
  287. Sounds.Lunge:Play()
  288.  
  289. if ToolUnequipped then
  290. ToolUnequipped:disconnect()
  291. end
  292.  
  293. local CurrentlyEquipped = true
  294.  
  295. ToolUnequipped = Tool.Unequipped:connect(function()
  296. CurrentlyEquipped = false
  297. end)
  298.  
  299. local Anim = Instance.new("StringValue")
  300. Anim.Name = "toolanim"
  301. Anim.Value = "Lunge"
  302. Anim.Parent = Tool
  303.  
  304. if CheckIfAlive() then
  305. Humanoid.WalkSpeed = (NormalSpeed + 100)
  306. local Force = Instance.new("BodyVelocity")
  307. Force.velocity = Vector3.new(0, 10, 0)
  308. Force.maxForce = Vector3.new(0, 4000, 0)
  309. Debris:AddItem(Force, 0.4)
  310. Force.Parent = Torso
  311. end
  312.  
  313. wait(0.2)
  314. Tool.Grip = Grips.Out
  315. wait(0.6)
  316. Tool.Grip = Grips.Up
  317.  
  318. if ToolUnequipped then
  319. ToolUnequipped:disconnect()
  320. end
  321.  
  322. if CurrentlyEquipped and CheckIfAlive() then
  323. Humanoid.WalkSpeed = RegularSpeed
  324. end
  325.  
  326. Damage = DamageValues.SlashDamage
  327. end
  328.  
  329. Tool.Enabled = true
  330. LastAttack = 0
  331.  
  332. function Activated()
  333.  
  334. if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
  335. return
  336. end
  337.  
  338. Tool.Enabled = false
  339.  
  340. Tick = RunService.Stepped:wait()
  341.  
  342. if (Tick - LastAttack < 0.2) then
  343. Lunge()
  344. else
  345. Attack()
  346. end
  347.  
  348. LastAttack = Tick
  349.  
  350. --wait(0.5)
  351.  
  352. Tool.Enabled = true
  353. end
  354.  
  355. function CheckIfAlive()
  356. return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
  357. end
  358.  
  359. function Equipped()
  360. Character = Tool.Parent
  361. Player = Players:GetPlayerFromCharacter(Character)
  362. Humanoid = Character:FindFirstChild("Humanoid")
  363. Torso = Character:FindFirstChild("Torso")
  364. if not CheckIfAlive() then
  365. return
  366. end
  367. ToolEquipped = true
  368. Humanoid.WalkSpeed = RegularSpeed
  369. Sounds.Unsheath:Play()
  370. end
  371.  
  372. function Unequipped()
  373. Tool.Grip = Grips.Up
  374. if CheckIfAlive() then
  375. Humanoid.WalkSpeed = NormalSpeed
  376. end
  377. ToolEquipped = false
  378. end
  379.  
  380. Tool.Activated:connect(Activated)
  381. Tool.Equipped:connect(Equipped)
  382. Tool.Unequipped:connect(Unequipped)
  383.  
  384. Connection = Handle.Touched:connect(Blow)
  385.  
  386. function SetSparkles(Table)
  387. for i, v in pairs(Table) do
  388. if v and v.Sparkles and v.Sparkles.Parent then
  389. local SparkleColor = ((v.Sparkles == Sparkles1 and (((v.Color and v.Color) or Color3.new(math.random(-5, 5), math.random(-10, 12), math.random(0, 15)))) or (v.Sparkles == Sparkles2 and ((v.Color and v.Color) or Color3.new(math.random(-21, 12), math.random(-2, 3), math.random(-20, 15))))))
  390. v.Sparkles.SparkleColor = SparkleColor
  391. if v.Light and v.Light.Parent then
  392. v.Light.Color = SparkleColor
  393. end
  394. end
  395. end
  396. end
  397.  
  398. Spawn(function()
  399. SetSparkles({{Sparkles = Sparkles1, Light = Light1, Color = Color3.new(1, 1, 1)}, {Sparkles = Sparkles2, Light = Light2, Color = Color3.new(1, 0, 1)}})
  400. while true do
  401. wait(3)
  402. SetSparkles({{Sparkles = Sparkles1, Light = Light1}, {Sparkles = Sparkles2, Light = Light2}})
  403. end
  404. end)
  405. end))
  406. LocalScript11.Name = "MouseIcon"
  407. LocalScript11.Parent = Tool0
  408. table.insert(cors,sandbox(LocalScript11,function()
  409. --Made by Luckymaxer
  410.  
  411. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  412. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  413.  
  414. Tool = script.Parent
  415.  
  416. Mouse = nil
  417.  
  418. function UpdateIcon()
  419. if Mouse then
  420. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  421. end
  422. end
  423.  
  424. function OnEquipped(ToolMouse)
  425. Mouse = ToolMouse
  426. UpdateIcon()
  427. end
  428.  
  429. function OnChanged(Property)
  430. if Property == "Enabled" then
  431. UpdateIcon()
  432. end
  433. end
  434.  
  435. Tool.Equipped:connect(OnEquipped)
  436. Tool.Changed:connect(OnChanged)
  437.  
  438. end))
  439. for i,v in pairs(mas:GetChildren()) do
  440. v.Parent = owner.Backpack
  441. pcall(function() v:MakeJoints() end)
  442. end
  443. mas:Destroy()
  444. for i,v in pairs(cors) do
  445. spawn(function()
  446. pcall(v)
  447. end)
  448. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement