Advertisement
BNutty07

Gun

Nov 13th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. SpecialMesh2 = Instance.new("SpecialMesh")
  22. Script3 = Instance.new("Script")
  23. Sound4 = Instance.new("Sound")
  24. Script5 = Instance.new("Script")
  25. Tool0.Name = "Gun"
  26. Tool0.Parent = mas
  27. Tool0.GripForward = Vector3.new(0.014998313, 0, -0.999887586)
  28. Tool0.GripPos = Vector3.new(0, 0, 1)
  29. Tool0.GripRight = Vector3.new(0.89165622, 0.452515543, 0.0133748427)
  30. Tool0.GripUp = Vector3.new(-0.45246467, 0.891756594, -0.00678696996)
  31. Part1.Name = "Handle"
  32. Part1.Parent = Tool0
  33. Part1.Rotation = Vector3.new(-89.2299957, -0.389999986, -116.759995)
  34. Part1.RotVelocity = Vector3.new(1, 1, 1)
  35. Part1.Size = Vector3.new(1, 1, 5)
  36. Part1.CFrame = CFrame.new(-15.0473862, 6.09787512, -13.2487059, -0.450310409, 0.892846406, -0.00678965962, -0.0150141492, 3.12112206e-05, 0.999887347, 0.892745912, 0.45036158, 0.0133912731)
  37. Part1.Position = Vector3.new(-15.0473862, 6.09787512, -13.2487059)
  38. Part1.Orientation = Vector3.new(-89.1399994, -26.8899994, -89.8799973)
  39. SpecialMesh2.Parent = Part1
  40. SpecialMesh2.MeshId = "rbxassetid://625948113"
  41. SpecialMesh2.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
  42. SpecialMesh2.TextureId = "rbxassetid://625948238"
  43. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  44. SpecialMesh2.Scale = Vector3.new(0.300000012, 0.300000012, 0.300000012)
  45. Script3.Name = "SoundScript"
  46. Script3.Parent = Part1
  47. table.insert(cors,sandbox(Script3,function()
  48. --Made by BLUEHHOOD--
  49.  
  50.  
  51. while true do
  52. wait(0)
  53. script.Sound:Play(150558724)--Change this to the musicid you want. Also change the sound inside of the script.--
  54. wait(70)--Change this to how long you want the music to play--
  55. end
  56. end))
  57. Sound4.Parent = Script3
  58. Sound4.SoundId = "rbxassetid://180955656"
  59. Sound4.Looped = true
  60. Script5.Name = "SwordScript"
  61. Script5.Parent = Part1
  62. table.insert(cors,sandbox(Script5,function()
  63. --Fixed by ImGuestLie
  64.  
  65. antiTK = true
  66.  
  67. teamgroups = {
  68.  
  69. --[[ HOW TO USE TEAMGROUPS:
  70. Put as many teams as you want in a table inside of teamgroups
  71. format for a teamcolor is BrickColor.new("TeamColor")
  72. type the EXACT teamcolor
  73.  
  74. When a player is on a team in a teamgroup, and the person (s)he is trying to kill is also in the same teamgroup,
  75. the user will not get damaged.
  76.  
  77. Basically this is like anti-TK but across multiple teams.
  78. --]]
  79.  
  80.  
  81.  
  82. --Example of a teamgroup:
  83. --{ BrickColor.new("Bright red"), BrickColor.new("Bright blue") }
  84.  
  85.  
  86. }
  87.  
  88. --END OF CONFIGURABLE OPTIONS--
  89.  
  90. r = game:service("RunService")
  91.  
  92. function candamage(myteam,theirteam)
  93. if antiTK == true and myteam == theirteam then return false end
  94. for i,v in pairs(teamgroups) do
  95. local ismyteam = false
  96. local istheirteam = false
  97. for _,v in pairs(teamgroups[i]) do
  98. if v == myteam then ismyteam = true end
  99. if v == theirteam then istheirteam = true end
  100. end
  101. if ismyteam == true and istheirteam == true then
  102. return false
  103. end
  104. end
  105. return true
  106. end
  107.  
  108. local acceptableparts = {
  109. "Head"; "Left Arm"; "Left Leg"; "Right Arm"; "Right Leg"; "Torso";
  110. }
  111.  
  112. function matches(partname)
  113. for i,v in pairs(acceptableparts) do
  114. if partname == v then
  115. return true
  116. end
  117. end
  118. return false
  119. end
  120.  
  121. local damage = 5
  122.  
  123. function blow(hit)
  124. if (hit.Parent == nil) then return end
  125.  
  126. if matches(hit.Name) then
  127.  
  128. local humanoid = hit.Parent:findFirstChild("Humanoid")
  129. local vCharacter = Tool.Parent
  130. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  131. local hum = vCharacter:findFirstChild("Humanoid")
  132. if humanoid and humanoid ~= hum and hum then
  133. -- final check, make sure sword is in-hand
  134. local guygettingsliced = game.Players:GetPlayerFromCharacter(hit.Parent) --OH LOOK, here's an edit
  135. local right_arm = vCharacter:FindFirstChild("Right Arm")
  136. if (right_arm) then
  137. local joint = right_arm:FindFirstChild("RightGrip")
  138. if (joint and (joint.Part0 == sword or joint.Part1 == sword)) then
  139. if guygettingsliced then --If he's a player
  140. if candamage(vPlayer.TeamColor, guygettingsliced.TeamColor) == true then
  141. tagHumanoid(humanoid, vPlayer)
  142. humanoid:TakeDamage(damage)
  143. wait(1)
  144. untagHumanoid(humanoid)
  145. end
  146. else --If he's not a player (AI, shop, etc)
  147. tagHumanoid(humanoid, vPlayer)
  148. humanoid:TakeDamage(damage)
  149. wait(1)
  150. untagHumanoid(humanoid)
  151. end
  152. end
  153. end
  154.  
  155. end
  156.  
  157. end
  158. end
  159.  
  160.  
  161. function tagHumanoid(humanoid, player)
  162. local creator_tag = Instance.new("ObjectValue")
  163. creator_tag.Value = player
  164. creator_tag.Name = "creator"
  165. creator_tag.Parent = humanoid
  166. end
  167.  
  168. function untagHumanoid(humanoid)
  169. if humanoid ~= nil then
  170. local tag = humanoid:findFirstChild("creator")
  171. if tag ~= nil then
  172. tag.Parent = nil
  173. end
  174. end
  175. end
  176.  
  177.  
  178. function attack()
  179. damage = slash_damage
  180. SlashSound:play()
  181. local anim = Instance.new("StringValue")
  182. anim.Name = "toolanim"
  183. anim.Value = "Slash"
  184. anim.Parent = Tool
  185. end
  186.  
  187. function lunge()
  188. damage = lunge_damage
  189.  
  190. LungeSound:play()
  191.  
  192. local anim = Instance.new("StringValue")
  193. anim.Name = "toolanim"
  194. anim.Value = "Lunge"
  195. anim.Parent = Tool
  196.  
  197.  
  198. force = Instance.new("BodyVelocity")
  199. force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
  200. force.maxForce = Vector3.new(0,2900,0)
  201. force.Parent = Tool.Parent.Torso
  202. wait(.25)
  203. swordOut()
  204. wait(.25)
  205. force.Parent = nil
  206. wait(.5)
  207. swordUp()
  208.  
  209. damage = slash_damage
  210. end
  211.  
  212. function swordUp()
  213. Tool.GripForward = Vector3.new(-1,0,0)
  214. Tool.GripRight = Vector3.new(0,1,0)
  215. Tool.GripUp = Vector3.new(0,0,1)
  216. end
  217.  
  218. function swordOut()
  219. Tool.GripForward = Vector3.new(0,0,1)
  220. Tool.GripRight = Vector3.new(0,-1,0)
  221. Tool.GripUp = Vector3.new(-1,0,0)
  222. end
  223.  
  224. function swordAcross()
  225. -- parry
  226. end
  227.  
  228.  
  229. Tool.Enabled = true
  230. local last_attack = 0
  231. function onActivated()
  232.  
  233. if not Tool.Enabled then
  234. return
  235. end
  236.  
  237. Tool.Enabled = false
  238.  
  239. local character = Tool.Parent;
  240. local humanoid = character.Humanoid
  241. if humanoid == nil then
  242. print("Humanoid not found")
  243. return
  244. end
  245.  
  246. t = r.Stepped:wait()
  247.  
  248. if (t - last_attack < .2) then
  249. lunge()
  250. else
  251. attack()
  252. end
  253.  
  254. last_attack = t
  255.  
  256. --wait(.5)
  257.  
  258. Tool.Enabled = true
  259. end
  260.  
  261. script.Parent.Activated:connect(onActivated)
  262. script.Parent.Equipped:connect(onEquipped)
  263.  
  264.  
  265. connection = sword.Touched:connect(blow)
  266.  
  267.  
  268.  
  269. end))
  270. for i,v in pairs(mas:GetChildren()) do
  271. v.Parent = workspace
  272. pcall(function() v:MakeJoints() end)
  273. end
  274. mas:Destroy()
  275. for i,v in pairs(cors) do
  276. spawn(function()
  277. pcall(v)
  278. end)
  279. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement