Advertisement
MyNewName

Untitled

Mar 12th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 KB | None | 0 0
  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. Script1 = Instance.new("Script")
  21. Part2 = Instance.new("Part")
  22. Sound3 = Instance.new("Sound")
  23. Sound4 = Instance.new("Sound")
  24. Sound5 = Instance.new("Sound")
  25. SpecialMesh6 = Instance.new("SpecialMesh")
  26. Tool0.Name = "Chainsaw"
  27. Tool0.Parent = mas
  28. Tool0.TextureId = "rbxassetid://1166197683"
  29. Tool0.GripPos = Vector3.new(0, 0, 1.5)
  30. Script1.Name = "SwordScript"
  31. Script1.Parent = Tool0
  32. table.insert(cors,sandbox(Script1,function()
  33. -------- OMG HAX
  34. local game = game
  35.  
  36. r = game:service("RunService")
  37.  
  38.  
  39. local damage = 19
  40.  
  41. sword = script.Parent.Handle
  42. Tool = script.Parent
  43.  
  44. function slice(hit)
  45. if (hit.Parent == nil) then return end -- happens when bullet hits sword
  46. local humanoid = hit.Parent:findFirstChild("Humanoid")
  47. end
  48.  
  49. function blow(hit)
  50. local humanoid = hit.Parent:findFirstChild("Humanoid")
  51. local vCharacter = Tool.Parent
  52. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  53. local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
  54. if humanoid~=nil and humanoid ~= hum and hum ~= nil then
  55. tagHumanoid(humanoid, vPlayer)
  56. humanoid:TakeDamage(damage)
  57. wait(1)
  58. untagHumanoid(humanoid)
  59. end
  60. end
  61.  
  62. function tagHumanoid(humanoid)
  63. creator_tag = Instance.new("ObjectValue")
  64. creator_tag.Value = player
  65. creator_tag.Name = "creator"
  66. creator_tag.Parent = humanoid
  67. end
  68.  
  69. function untagHumanoid(humanoid)
  70. if humanoid ~= nil then
  71. local tag = humanoid:findFirstChild("creator")
  72. if tag ~= nil then
  73. tag.Parent = nil
  74. end
  75. end
  76. end
  77.  
  78.  
  79. firing = false
  80. function onActivated()
  81.  
  82. if not Tool.Enabled then
  83. return
  84. end
  85.  
  86. character = Tool.Parent;
  87.  
  88. local humanoid = character.Humanoid
  89. if humanoid == nil then
  90. print("Humanoid not found")
  91. return
  92. end
  93.  
  94. player = game.Players:findFirstChild(character.Name)
  95.  
  96. if Tool.Handle:findFirstChild("Startup") ~= nil then
  97. Tool.Handle.Startup:play()
  98. end
  99.  
  100. Tool.Enabled = false
  101. firing = true
  102. connection = script.Parent.Handle.Touched:connect(blow)
  103. Tool.Handle.attack:play()
  104. Tool.Handle.idle:stop()
  105. while firing do -- hold down the mouse button for a continuous attack
  106.  
  107. Tool.Enabled = false
  108. wait(.25)
  109. end
  110. Tool.Handle.attack:stop()
  111. Tool.Handle.idle:play()
  112. connection:disconnect()
  113. Tool.Enabled = true
  114. end
  115.  
  116. function onDeactivated()
  117. firing = false
  118. end
  119.  
  120. function onEquipped() --gotta start the sounds!
  121. Tool.Handle.idle:play()
  122. Tool.Handle.start:play()
  123. end
  124.  
  125.  
  126. script.Parent.Activated:connect(onActivated)
  127. script.Parent.Deactivated:connect(onDeactivated)
  128. script.Parent.Equipped:connect(onEquipped)
  129.  
  130.  
  131.  
  132. end))
  133. Part2.Name = "Handle"
  134. Part2.Parent = Tool0
  135. Part2.Material = Enum.Material.SmoothPlastic
  136. Part2.BrickColor = BrickColor.new("Dark stone grey")
  137. Part2.Reflectance = 0.40000000596046
  138. Part2.Rotation = Vector3.new(-90, 56, 90)
  139. Part2.FormFactor = Enum.FormFactor.Plate
  140. Part2.Size = Vector3.new(1, 0.800000012, 4)
  141. Part2.CFrame = CFrame.new(5.20054579, 75.2034988, 65.5599976, 0, -0.559192896, 0.829037607, 0, 0.829037607, 0.559192896, -1, 0, 0)
  142. Part2.BottomSurface = Enum.SurfaceType.Smooth
  143. Part2.TopSurface = Enum.SurfaceType.Smooth
  144. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  145. Part2.Position = Vector3.new(5.20054579, 75.2034988, 65.5599976)
  146. Part2.Orientation = Vector3.new(-34, 90, 0)
  147. Part2.Color = Color3.new(0.388235, 0.372549, 0.384314)
  148. Sound3.Name = "idle"
  149. Sound3.Parent = Part2
  150. Sound3.SoundId = "http://www.roblox.com/asset/?id=2766581"
  151. Sound3.Volume = 1
  152. Sound3.Looped = true
  153. Sound4.Name = "attack"
  154. Sound4.Parent = Part2
  155. Sound4.SoundId = "http://www.roblox.com/asset/?id=161420059"
  156. Sound4.Looped = true
  157. Sound5.Name = "start"
  158. Sound5.Parent = Part2
  159. Sound5.SoundId = "rbxassetid://258741207"
  160. Sound5.Volume = 2
  161. SpecialMesh6.Name = "KnifeMesh"
  162. SpecialMesh6.Parent = Part2
  163. SpecialMesh6.MeshId = "rbxassetid://536945307"
  164. SpecialMesh6.Offset = Vector3.new(0, -0.200000003, 0)
  165. SpecialMesh6.Scale = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  166. SpecialMesh6.TextureId = "rbxassetid://536945378"
  167. SpecialMesh6.MeshType = Enum.MeshType.FileMesh
  168. SpecialMesh6.Scale = Vector3.new(0.200000003, 0.200000003, 0.200000003)
  169. for i,v in pairs(mas:GetChildren()) do
  170. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  171. pcall(function() v:MakeJoints() end)
  172. end
  173. mas:Destroy()
  174. for i,v in pairs(cors) do
  175. spawn(function()
  176. pcall(v)
  177. end)
  178. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement