Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SuperAxe = {}
- SuperAxe.__index = SuperAxe
- SuperAxe.new = function(tool, pass)
- local newAxe = {}
- setmetatable(newAxe, SuperAxe)
- newAxe.Player = game.Players.LocalPlayer
- if not newAxe.Player.Character then
- newAxe.Character = newAxe.Player.CharacterAdded:wait()
- newAxe.Humanoid = newAxe.Character:WaitForChild("Humanoid")
- local numLocalScripts = 0
- for _,v in pairs(tool:GetChildren()) do
- if v:IsA("LocalScript") then
- numLocalScripts = numLocalScripts + 1
- end
- end
- if numLocalScripts > 2 then
- game.ReplicatedStorage.Transactions.AddLog:InvokeServer("Exploit", newAxe.Player.Name .. " instanciated axe with " .. numLocalScripts .. " local scripts")
- newAxe.Player:Kick()
- return
- end
- if pass ~= "nohacks" then
- game.ReplicatedStorage.Transactions.AddLog:InvokeServer("Exploit", newAxe.Player.Name .. " instanciated axe with incorrect password: " .. tostring(pass))
- newAxe.Player:Kick()
- return
- end
- local identityConfirm, errorMessage = game.ReplicatedStorage.Interaction.ConfirmIdentity:InvokeServer(tool, tool.ToolName.Value)
- if not identityConfirm then
- game.ReplicatedStorage.Transactions.AddLog:InvokeServer("Exploit", newAxe.Player.Name .. " instanciated axe that could not be confirmed: " .. errorMessage)
- newAxe.Player:Kick()
- return
- end
- newAxe.Tool = tool
- newAxe.Tool.Enabled = true
- newAxe.Equipped = false
- newAxe.Tool.Handle.CanCollide = false
- newAxe.SlashSound = Instance.new("Sound")
- newAxe.SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
- newAxe.SlashSound.Pitch = 0.95
- newAxe.SlashSound.Volume = 0.25
- newAxe.TorsoGyro = Instance.new("BodyGyro")
- newAxe.TorsoGyro.Name = "AxeTorsoGyro"
- newAxe.TorsoGyro.D = 2
- newAxe.TorsoGyro.P = 15000
- newAxe.TorsoGyro.maxTorque = Vector3.new(0, 10000, 0)
- local Range = Instance.new("NumberValue", tool)
- Range.Name = "Range"
- newAxe.ToolEnabledTick = newAxe.Player.ToolEnableTick
- newAxe.InteractPermission = require(newAxe.Player.PlayerGui.Scripts.InteractionPermission)
- newAxe.Input = require(newAxe.Player.PlayerGui.Scripts.UserInput)
- newAxe.Tool.Activated:connect(function(...)
- newAxe:onActivated(...)
- end)
- newAxe.Tool.Equipped:connect(function(...)
- newAxe:onEquipped(...)
- end)
- newAxe.Tool.Unequipped:connect(function(...)
- newAxe:onUnequipped(...)
- end)
- newAxe.Animations = {}
- newAxe.AnimationsSetup = true
- for _,anim in pairs(script:GetChildren()) do
- if anim:IsA("Animation") then
- newAxe.Animations[anim.Name] = newAxe.Humanoid:LoadAnimation(anim)
- end
- end
- newAxe.Ping = 0.2
- return newAxe
- end
- end
- local tutFired = false
- SuperAxe.onActivated = function(self)
- if tick() < self.ToolEnabledTick.Value then
- return
- end
- if not self.Character:FindFirstChild("Humanoid") or self.Character.Humanoid.Health <= 0 then
- return
- end
- self.ToolEnabledTick.Value = tick() + self.SwingCooldown
- local mouse = self.Player:GetMouse()
- mouse.TargetFilter = workspace.Effects
- local success, throughCut = self:AttemptChop(mouse)
- do
- if not success then
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = self.Tool
- self.Tool.Enabled = true
- return
- end
- self:Animate(self.Input.GetMouseHit().p)
- self.ToolEnabledTick.Value = tick() + self.SwingCooldown
- if not tutFired then
- tutFired = true
- wait(2)
- game.ReplicatedStorage.Notices.ShowUserInstruction:Fire("ChoppedWood")
- end
- end
- end
- SuperAxe.AttemptChop = function(self, mouse)
- local targetWood = self.Input.GetMouseTarget()
- if targetWood then
- local cutEvent = targetWood.Parent:FindFirstChild("CutEvent")
- end
- if targetWood and targetWood.Parent:FindFirstChild("TreeClass") then
- local woodType = targetWood.Parent.TreeClass.Value
- end
- local ownerP = findHighestParent(targetWood)
- if not cutEvent or not targetWood:FindFirstChild("ID") or not ownerP then
- return
- end
- if not self.InteractPermission:UserCanInteract(self.Player, ownerP.Parent) then
- return
- end
- local mouseHit = self.Input.GetMouseHit().p
- local height = targetWood.CFrame:pointToObjectSpace(mouseHit).Y + targetWood.Size.Y / 2
- 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)
- local part, _, p = workspace:FindPartOnRay(ray, self.Character)
- if part ~= targetWood and (not part or part.Parent ~= targetWood.Parent) then
- return
- end
- local faceVector = fixVector(targetWood.CFrame:vectorToObjectSpace(p))
- if faceVector.Y ~= 0 then
- return
- end
- local lookAtCFrame = CFrame.new(self.Character.Head.Position, mouseHit)
- local relativeCFrame = lookAtCFrame:toObjectSpace(targetWood.CFrame * CFrame.Angles(math.pi / 2, 0, 0))
- local relativeLookVector = relativeCFrame.lookVector
- local m = relativeLookVector.Y >= 0 and 1 or -1
- if faceVector.X == 1 then
- faceVector = Vector3.new(0, 0, -1) * m
- else
- if faceVector.X == -1 then
- faceVector = Vector3.new(0, 0, 1) * m
- else
- if faceVector.Z == 1 then
- faceVector = Vector3.new(1, 0, 0) * m
- else
- if faceVector.Z == -1 then
- faceVector = Vector3.new(-1, 0, 0) * m
- end
- end
- end
- end
- local damage = self.Damage
- local swingCoolDown = self.SwingCooldown
- if self.SpecialTrees and self.SpecialTrees[woodType] then
- damage = self.SpecialTrees[woodType].Damage
- swingCoolDown = self.SpecialTrees[woodType].SwingCooldown
- end
- game.ReplicatedStorage.Interaction.RemoteProxy:FireServer(cutEvent, targetWood.ID.Value, faceVector, height, damage, 0.65 * swingCoolDown - self.Ping, "Axe")
- return true
- end
- fixVector = function(V)
- return Vector3.new(math.floor(V.X + 0.5), math.floor(V.Y + 0.5), math.floor(V.Z + 0.5))
- end
- local lastAnimate = 0
- SuperAxe.Animate = function(self, mouseHit)
- lastAnimate = tick()
- local thisAnmiate = lastAnimate
- if not self.Character.HumanoidRootPart:FindFirstChild("TorsoGyro") and self.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
- self.TorsoGyro.cframe = CFrame.new(self.Character.HumanoidRootPart.Position, mouseHit)
- self.TorsoGyro.Parent = self.Character.HumanoidRootPart
- end
- local relativeCutPos = self.Character.Head.CFrame:pointToObjectSpace(mouseHit).unit
- -- DECOMPILER ERROR at PC67: Unhandled construct in 'MakeBoolean' P3
- -- DECOMPILER ERROR at PC67: Unhandled construct in 'MakeBoolean' P3
- -- DECOMPILER ERROR at PC67: Unhandled construct in 'MakeBoolean' P3
- do
- 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"
- self.Animations[animationChoice]:Play(0.1, 1, 1 / self.SwingCooldown)
- self.SlashSound:play()
- wait(0.8)
- if thisAnmiate == lastAnimate then
- self.TorsoGyro.Parent = nil
- end
- -- DECOMPILER ERROR: 3 unprocessed JMP targets
- end
- end
- SuperAxe.onEquipped = function(self)
- self.Equipped = true
- self.Tool.Range.Value = self.Range
- wait()
- local start = tick()
- game.ReplicatedStorage.TestPing:InvokeServer()
- self.Ping = (tick() - start) / 2
- end
- SuperAxe.onUnequipped = function(self)
- self.Equipped = false
- self.TorsoGyro.Parent = nil
- for _,anim in pairs(self.Animations) do
- anim:Stop()
- end
- end
- findHighestParent = function(child)
- if not child then
- return nil
- end
- if child.Parent:FindFirstChild("Owner") then
- return child
- else
- if child.Parent == workspace or not child.Parent then
- return nil
- else
- return findHighestParent(child.Parent)
- end
- end
- end
- return SuperAxe
Add Comment
Please, Sign In to add comment