Gokussjg

Untitled

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