mr2meows

LinkedSword

Jul 3rd, 2022 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.22 KB | None | 0 0
  1. -- Objects To Lua Make By HairBaconGamming --
  2. local Module_Scripts = {}
  3. local LinkedSword = Instance.new("Tool")
  4. local Handle = Instance.new("Part")
  5. local Mesh = Instance.new("SpecialMesh")
  6. local SwordSlash = Instance.new("Sound")
  7. local SwordLunge = Instance.new("Sound")
  8. local Unsheath = Instance.new("Sound")
  9. local SwordScript = Instance.new("Script")
  10. local MouseIcon = Instance.new("LocalScript")
  11.  
  12. -- Properties --
  13.  
  14. LinkedSword.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0)
  15. LinkedSword.GripForward = Vector3.new(-1, -0, -0)
  16. LinkedSword.GripPos = Vector3.new(0, 0, -1.5)
  17. LinkedSword.GripRight = Vector3.new(0, 1, 0)
  18. LinkedSword.GripUp = Vector3.new(0, 0, 1)
  19. LinkedSword.Name = [[LinkedSword]]
  20. LinkedSword.Parent = owner.Backpack
  21. LinkedSword.TextureId = [[rbxasset://Textures/Sword128.png]]
  22.  
  23. Handle.BottomSurface = Enum.SurfaceType.Smooth
  24. Handle.BrickColor = BrickColor.new([[Dark stone grey]])
  25. Handle.CFrame = CFrame.new(13.2380266, 1.88733482, -17.8422318, 0.0910440385, -0.881099463, 0.464084357, 0.537011683, 0.435894847, 0.722229123, -0.838648558, 0.183463722, 0.512845576)
  26. Handle.Color = Color3.new(0.388235, 0.372549, 0.384314)
  27. Handle.Locked = true
  28. Handle.Name = [[Handle]]
  29. Handle.Orientation = Vector3.new(-46.2400016784668, 42.13999938964844, 50.93000030517578)
  30. Handle.Parent = LinkedSword
  31. Handle.Position = Vector3.new(13.23802661895752, 1.8873348236083984, -17.84223175048828)
  32. Handle.Reflectance = 0.4000000059604645
  33. Handle.Rotation = Vector3.new(-54.619998931884766, 27.649999618530273, 84.0999984741211)
  34. Handle.Size = Vector3.new(1, 0.800000011920929, 4)
  35. Handle.TopSurface = Enum.SurfaceType.Smooth
  36.  
  37. Mesh.MeshId = [[rbxasset://fonts/sword.mesh]]
  38. Mesh.MeshType = Enum.MeshType.FileMesh
  39. Mesh.Parent = Handle
  40. Mesh.TextureId = [[rbxasset://textures/SwordTexture.png]]
  41.  
  42. SwordSlash.Name = [[SwordSlash]]
  43. SwordSlash.Parent = Handle
  44. SwordSlash.SoundId = [[http://www.roblox.com/asset/?id=12222216]]
  45. SwordSlash.Volume = 0.699999988079071
  46.  
  47. SwordLunge.Name = [[SwordLunge]]
  48. SwordLunge.Parent = Handle
  49. SwordLunge.SoundId = [[http://www.roblox.com/asset/?id=12222208]]
  50. SwordLunge.Volume = 0.6000000238418579
  51.  
  52. Unsheath.Name = [[Unsheath]]
  53. Unsheath.Parent = Handle
  54. Unsheath.SoundId = [[http://www.roblox.com/asset/?id=12222225]]
  55. Unsheath.Volume = 1
  56.  
  57. function SwordScript_ScriptfakeXD()
  58.  
  59. local script = Instance.new("Script",LinkedSword)
  60. SwordScript = script
  61. script.Name = [[SwordScript]]
  62. local require_fake = require
  63. local require = function(Object)
  64. local functiom = Module_Scripts[Object]
  65. if functiom then
  66. return functiom()
  67. end
  68. return require_fake(Object)
  69. end
  70.  
  71. --Rescripted by Luckymaxer
  72. --EUROCOW WAS HERE BECAUSE I MADE THE PARTICLES AND THEREFORE THIS ENTIRE SWORD PRETTY AND LOOK PRETTY WORDS AND I'D LIKE TO DEDICATE THIS TO MY FRIENDS AND HI LUCKYMAXER PLS FIX SFOTH SWORDS TY LOVE Y'ALl
  73. --Updated for R15 avatars by StarWars
  74. --Re-updated by TakeoHonorable
  75.  
  76. Tool = script.Parent
  77. Handle = Tool:WaitForChild("Handle")
  78.  
  79. function Create(ty)
  80. return function(data)
  81. local obj = Instance.new(ty)
  82. for k, v in pairs(data) do
  83. if type(k) == 'number' then
  84. v.Parent = obj
  85. else
  86. obj[k] = v
  87. end
  88. end
  89. return obj
  90. end
  91. end
  92.  
  93. local BaseUrl = "rbxassetid://"
  94.  
  95. Players = game:GetService("Players")
  96. Debris = game:GetService("Debris")
  97. RunService = game:GetService("RunService")
  98.  
  99. DamageValues = {
  100. BaseDamage = 5,
  101. SlashDamage = 10,
  102. LungeDamage = 30
  103. }
  104.  
  105. --For R15 avatars
  106. Animations = {
  107. R15Slash = 522635514,
  108. R15Lunge = 522638767
  109. }
  110.  
  111. Damage = DamageValues.BaseDamage
  112.  
  113. Grips = {
  114. Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
  115. Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
  116. }
  117.  
  118. Sounds = {
  119. Slash = Handle:WaitForChild("SwordSlash"),
  120. Lunge = Handle:WaitForChild("SwordLunge"),
  121. Unsheath = Handle:WaitForChild("Unsheath")
  122. }
  123.  
  124. ToolEquipped = false
  125.  
  126. --For Omega Rainbow Katana thumbnail to display a lot of particles.
  127. for i, v in pairs(Handle:GetChildren()) do
  128. if v:IsA("ParticleEmitter") then
  129. v.Rate = 20
  130. end
  131. end
  132.  
  133. Tool.Grip = Grips.Up
  134. Tool.Enabled = true
  135.  
  136. function IsTeamMate(Player1, Player2)
  137. return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
  138. end
  139.  
  140. function TagHumanoid(humanoid, player)
  141. local Creator_Tag = Instance.new("ObjectValue")
  142. Creator_Tag.Name = "creator"
  143. Creator_Tag.Value = player
  144. Debris:AddItem(Creator_Tag, 2)
  145. Creator_Tag.Parent = humanoid
  146. end
  147.  
  148. function UntagHumanoid(humanoid)
  149. for i, v in pairs(humanoid:GetChildren()) do
  150. if v:IsA("ObjectValue") and v.Name == "creator" then
  151. v:Destroy()
  152. end
  153. end
  154. end
  155.  
  156. function Blow(Hit)
  157. if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
  158. return
  159. end
  160. local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
  161. if not RightArm then
  162. return
  163. end
  164. local RightGrip = RightArm:FindFirstChild("RightGrip")
  165. if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
  166. return
  167. end
  168. local character = Hit.Parent
  169. if character == Character then
  170. return
  171. end
  172. local humanoid = character:FindFirstChildOfClass("Humanoid")
  173. if not humanoid or humanoid.Health == 0 then
  174. return
  175. end
  176. local player = Players:GetPlayerFromCharacter(character)
  177. if player and (player == Player or IsTeamMate(Player, player)) then
  178. return
  179. end
  180. UntagHumanoid(humanoid)
  181. TagHumanoid(humanoid, Player)
  182. humanoid:TakeDamage(Damage)
  183. end
  184.  
  185.  
  186. function Attack()
  187. Damage = DamageValues.SlashDamage
  188. Sounds.Slash:Play()
  189.  
  190. if Humanoid then
  191. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  192. local Anim = Instance.new("StringValue")
  193. Anim.Name = "toolanim"
  194. Anim.Value = "Slash"
  195. Anim.Parent = Tool
  196. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  197. local Anim = Tool:FindFirstChild("R15Slash")
  198. if Anim then
  199. local Track = Humanoid:LoadAnimation(Anim)
  200. Track:Play(0)
  201. end
  202. end
  203. end
  204. end
  205.  
  206. function Lunge()
  207. Damage = DamageValues.LungeDamage
  208.  
  209. Sounds.Lunge:Play()
  210.  
  211. if Humanoid then
  212. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  213. local Anim = Instance.new("StringValue")
  214. Anim.Name = "toolanim"
  215. Anim.Value = "Lunge"
  216. Anim.Parent = Tool
  217. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  218. local Anim = Tool:FindFirstChild("R15Lunge")
  219. if Anim then
  220. local Track = Humanoid:LoadAnimation(Anim)
  221. Track:Play(0)
  222. end
  223. end
  224. end
  225.  
  226. if CheckIfAlive() then
  227. local Force = Instance.new("BodyVelocity")
  228. Force.velocity = Vector3.new(0, 10, 0)
  229. Force.maxForce = Vector3.new(0, 4000, 0)
  230. Debris:AddItem(Force, 0.4)
  231. Force.Parent = Torso
  232. end
  233.  
  234.  
  235. wait(0.2)
  236. Tool.Grip = Grips.Out
  237. wait(0.6)
  238. Tool.Grip = Grips.Up
  239.  
  240. Damage = DamageValues.SlashDamage
  241. end
  242.  
  243. Tool.Enabled = true
  244. LastAttack = 0
  245.  
  246. function Activated()
  247. if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
  248. return
  249. end
  250. Tool.Enabled = false
  251. local Tick = RunService.Stepped:wait()
  252. if (Tick - LastAttack < 0.2) then
  253. Lunge()
  254. else
  255. Attack()
  256. end
  257. LastAttack = Tick
  258. --wait(0.5)
  259. Damage = DamageValues.BaseDamage
  260. local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
  261. Name = "R15Slash",
  262. AnimationId = BaseUrl .. Animations.R15Slash,
  263. Parent = Tool
  264. })
  265.  
  266. local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
  267. Name = "R15Lunge",
  268. AnimationId = BaseUrl .. Animations.R15Lunge,
  269. Parent = Tool
  270. })
  271. Tool.Enabled = true
  272. end
  273.  
  274. function CheckIfAlive()
  275. 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)
  276. end
  277.  
  278. function Equipped()
  279. Character = Tool.Parent
  280. Player = Players:GetPlayerFromCharacter(Character)
  281. Humanoid = Character:FindFirstChildOfClass("Humanoid")
  282. Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
  283. if not CheckIfAlive() then
  284. return
  285. end
  286. ToolEquipped = true
  287. Sounds.Unsheath:Play()
  288. end
  289.  
  290. function Unequipped()
  291. Tool.Grip = Grips.Up
  292. ToolEquipped = false
  293. end
  294.  
  295. Tool.Activated:Connect(Activated)
  296. Tool.Equipped:Connect(Equipped)
  297. Tool.Unequipped:Connect(Unequipped)
  298.  
  299. Connection = Handle.Touched:Connect(Blow)
  300.  
  301. end
  302. coroutine.wrap(SwordScript_ScriptfakeXD)()
  303.  
  304.  
  305. function MouseIcon_ScriptfakeXD()
  306.  
  307. local script = Instance.new("LocalScript",LinkedSword)
  308. MouseIcon = script
  309. script.Name = [[MouseIcon]]
  310. local require_fake = require
  311. local require = function(Object)
  312. local functiom = Module_Scripts[Object]
  313. if functiom then
  314. return functiom()
  315. end
  316. return require_fake(Object)
  317. end
  318.  
  319. --Made by Luckymaxer
  320.  
  321. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  322. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  323.  
  324. Tool = script.Parent
  325.  
  326. Mouse = nil
  327.  
  328. function UpdateIcon()
  329. if Mouse then
  330. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  331. end
  332. end
  333.  
  334. function OnEquipped(ToolMouse)
  335. Mouse = ToolMouse
  336. UpdateIcon()
  337. end
  338.  
  339. function OnChanged(Property)
  340. if Property == "Enabled" then
  341. UpdateIcon()
  342. end
  343. end
  344.  
  345. Tool.Equipped:Connect(OnEquipped)
  346. Tool.Changed:Connect(OnChanged)
  347.  
  348.  
  349. end
  350. coroutine.wrap(MouseIcon_ScriptfakeXD)()
  351.  
  352.  
  353. -- End --
  354. -- Thank for using --
Add Comment
Please, Sign In to add comment