lolita5432

Untitled

Feb 24th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.87 KB | None | 0 0
  1. SuperAxe = {}
  2. SuperAxe.__index = SuperAxe
  3. SuperAxe.new = function(tool, pass)
  4. local newAxe = {}
  5. setmetatable(newAxe, SuperAxe)
  6. newAxe.Player = game.Players.LocalPlayer
  7. if not newAxe.Player.Character then
  8. newAxe.Character = newAxe.Player.CharacterAdded:wait()
  9. newAxe.Humanoid = newAxe.Character:WaitForChild("Humanoid")
  10. local numLocalScripts = 0
  11. for _,v in pairs(tool:GetChildren()) do
  12. if v:IsA("LocalScript") then
  13. numLocalScripts = numLocalScripts + 1
  14. end
  15. end
  16. if numLocalScripts > 2 then
  17. game.ReplicatedStorage.Transactions.AddLog:InvokeServer("Exploit", newAxe.Player.Name .. " instanciated axe with " .. numLocalScripts .. " local scripts")
  18. newAxe.Player:Kick()
  19. return
  20. end
  21. if pass ~= "nohacks" then
  22. game.ReplicatedStorage.Transactions.AddLog:InvokeServer("Exploit", newAxe.Player.Name .. " instanciated axe with incorrect password: " .. tostring(pass))
  23. newAxe.Player:Kick()
  24. return
  25. end
  26. local identityConfirm, errorMessage = game.ReplicatedStorage.Interaction.ConfirmIdentity:InvokeServer(tool, tool.ToolName.Value)
  27. if not identityConfirm then
  28. game.ReplicatedStorage.Transactions.AddLog:InvokeServer("Exploit", newAxe.Player.Name .. " instanciated axe that could not be confirmed: " .. errorMessage)
  29. newAxe.Player:Kick()
  30. return
  31. end
  32. newAxe.Tool = tool
  33. newAxe.Tool.Enabled = true
  34. newAxe.Equipped = false
  35. newAxe.Tool.Handle.CanCollide = false
  36. newAxe.SlashSound = Instance.new("Sound")
  37. newAxe.SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
  38. newAxe.SlashSound.Pitch = 0.95
  39. newAxe.SlashSound.Volume = 0.25
  40. newAxe.TorsoGyro = Instance.new("BodyGyro")
  41. newAxe.TorsoGyro.Name = "AxeTorsoGyro"
  42. newAxe.TorsoGyro.D = 2
  43. newAxe.TorsoGyro.P = 15000
  44. newAxe.TorsoGyro.maxTorque = Vector3.new(0, 10000, 0)
  45. local Range = Instance.new("NumberValue", tool)
  46. Range.Name = "Range"
  47. newAxe.ToolEnabledTick = newAxe.Player.ToolEnableTick
  48. newAxe.InteractPermission = require(newAxe.Player.PlayerGui.Scripts.InteractionPermission)
  49. newAxe.Input = require(newAxe.Player.PlayerGui.Scripts.UserInput)
  50. newAxe.Tool.Activated:connect(function(...)
  51. newAxe:onActivated(...)
  52. end)
  53. newAxe.Tool.Equipped:connect(function(...)
  54. newAxe:onEquipped(...)
  55. end)
  56. newAxe.Tool.Unequipped:connect(function(...)
  57. newAxe:onUnequipped(...)
  58. end)
  59. newAxe.Animations = {}
  60. newAxe.AnimationsSetup = true
  61. for _,anim in pairs(script:GetChildren()) do
  62. if anim:IsA("Animation") then
  63. newAxe.Animations[anim.Name] = newAxe.Humanoid:LoadAnimation(anim)
  64. end
  65. end
  66. newAxe.Ping = 0.2
  67. return newAxe
  68. end
  69. end
  70. local tutFired = false
  71. SuperAxe.onActivated = function(self)
  72. if tick() < self.ToolEnabledTick.Value then
  73. return
  74. end
  75. if not self.Character:FindFirstChild("Humanoid") or self.Character.Humanoid.Health <= 0 then
  76. return
  77. end
  78. self.ToolEnabledTick.Value = tick() + self.SwingCooldown
  79. local mouse = self.Player:GetMouse()
  80. mouse.TargetFilter = workspace.Effects
  81. local success, throughCut = self:AttemptChop(mouse)
  82. do
  83. if not success then
  84. local anim = Instance.new("StringValue")
  85. anim.Name = "toolanim"
  86. anim.Value = "Slash"
  87. anim.Parent = self.Tool
  88. self.Tool.Enabled = true
  89. return
  90. end
  91. self:Animate(self.Input.GetMouseHit().p)
  92. self.ToolEnabledTick.Value = tick() + self.SwingCooldown
  93. if not tutFired then
  94. tutFired = true
  95. wait(2)
  96. game.ReplicatedStorage.Notices.ShowUserInstruction:Fire("ChoppedWood")
  97. end
  98. end
  99. end
  100. SuperAxe.AttemptChop = function(self, mouse)
  101. local targetWood = self.Input.GetMouseTarget()
  102. if targetWood then
  103. local cutEvent = targetWood.Parent:FindFirstChild("CutEvent")
  104. end
  105. if targetWood and targetWood.Parent:FindFirstChild("TreeClass") then
  106. local woodType = targetWood.Parent.TreeClass.Value
  107. end
  108. local ownerP = findHighestParent(targetWood)
  109. if not cutEvent or not targetWood:FindFirstChild("ID") or not ownerP then
  110. return
  111. end
  112. if not self.InteractPermission:UserCanInteract(self.Player, ownerP.Parent) then
  113. return
  114. end
  115. local mouseHit = self.Input.GetMouseHit().p
  116. local height = targetWood.CFrame:pointToObjectSpace(mouseHit).Y + targetWood.Size.Y / 2
  117. local ray = Ray.new(self.Character.Head.Position, targetWood.CFrame * CFrame.new(0, height - targetWood.Size.Y / 2, 0).p - self.Character.Head.Position.unit * self.Range)
  118. local part, _, p = workspace:FindPartOnRay(ray, self.Character)
  119. if part ~= targetWood and (not part or part.Parent ~= targetWood.Parent) then
  120. return
  121. end
  122. local faceVector = fixVector(targetWood.CFrame:vectorToObjectSpace(p))
  123. if faceVector.Y ~= 0 then
  124. return
  125. end
  126. local lookAtCFrame = CFrame.new(self.Character.Head.Position, mouseHit)
  127. local relativeCFrame = lookAtCFrame:toObjectSpace(targetWood.CFrame * CFrame.Angles(math.pi / 2, 0, 0))
  128. local relativeLookVector = relativeCFrame.lookVector
  129. local m = relativeLookVector.Y >= 0 and 1 or -1
  130. if faceVector.X == 1 then
  131. faceVector = Vector3.new(0, 0, -1) * m
  132. else
  133. if faceVector.X == -1 then
  134. faceVector = Vector3.new(0, 0, 1) * m
  135. else
  136. if faceVector.Z == 1 then
  137. faceVector = Vector3.new(1, 0, 0) * m
  138. else
  139. if faceVector.Z == -1 then
  140. faceVector = Vector3.new(-1, 0, 0) * m
  141. end
  142. end
  143. end
  144. end
  145. local damage = self.Damage
  146. local swingCoolDown = self.SwingCooldown
  147. if self.SpecialTrees and self.SpecialTrees[woodType] then
  148. damage = self.SpecialTrees[woodType].Damage
  149. swingCoolDown = self.SpecialTrees[woodType].SwingCooldown
  150. end
  151. game.ReplicatedStorage.Interaction.RemoteProxy:FireServer(cutEvent, targetWood.ID.Value, faceVector, height, damage, 0.65 * swingCoolDown - self.Ping, "Axe")
  152. return true
  153. end
  154. fixVector = function(V)
  155. return Vector3.new(math.floor(V.X + 0.5), math.floor(V.Y + 0.5), math.floor(V.Z + 0.5))
  156. end
  157. local lastAnimate = 0
  158. SuperAxe.Animate = function(self, mouseHit)
  159. lastAnimate = tick()
  160. local thisAnmiate = lastAnimate
  161. if not self.Character.HumanoidRootPart:FindFirstChild("TorsoGyro") and self.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
  162. self.TorsoGyro.cframe = CFrame.new(self.Character.HumanoidRootPart.Position, mouseHit)
  163. self.TorsoGyro.Parent = self.Character.HumanoidRootPart
  164. end
  165. local relativeCutPos = self.Character.Head.CFrame:pointToObjectSpace(mouseHit).unit
  166. -- DECOMPILER ERROR at PC67: Unhandled construct in 'MakeBoolean' P3
  167.  
  168. -- DECOMPILER ERROR at PC67: Unhandled construct in 'MakeBoolean' P3
  169.  
  170. -- DECOMPILER ERROR at PC67: Unhandled construct in 'MakeBoolean' P3
  171.  
  172. do
  173. local animationChoice = (relativeCutPos.Y >= -0.6 or not "AxeSwing1") and relativeCutPos.Y < -0.2 and relativeCutPos.Y < 0.2 and relativeCutPos.Y < 0.6 and relativeCutPos.Y < 1 and "AxeSwing5"
  174. self.Animations[animationChoice]:Play(0.1, 1, 1 / self.SwingCooldown)
  175. self.SlashSound:play()
  176. wait(0.8)
  177. if thisAnmiate == lastAnimate then
  178. self.TorsoGyro.Parent = nil
  179. end
  180. -- DECOMPILER ERROR: 3 unprocessed JMP targets
  181. end
  182. end
  183. SuperAxe.onEquipped = function(self)
  184. self.Equipped = true
  185. self.Tool.Range.Value = self.Range
  186. wait()
  187. local start = tick()
  188. game.ReplicatedStorage.TestPing:InvokeServer()
  189. self.Ping = (tick() - start) / 2
  190. end
  191. SuperAxe.onUnequipped = function(self)
  192. self.Equipped = false
  193. self.TorsoGyro.Parent = nil
  194. for _,anim in pairs(self.Animations) do
  195. anim:Stop()
  196. end
  197. end
  198. findHighestParent = function(child)
  199. if not child then
  200. return nil
  201. end
  202. if child.Parent:FindFirstChild("Owner") then
  203. return child
  204. else
  205. if child.Parent == workspace or not child.Parent then
  206. return nil
  207. else
  208. return findHighestParent(child.Parent)
  209. end
  210. end
  211. end
  212. return SuperAxe
Add Comment
Please, Sign In to add comment