function getPlayer()local K=Tool.Parent return(game:GetService("\080\108\097\121\101\114\115")):GetPlayerFromCharacter(Character)end function Toss(K)local k=Vector3.new(Tool.Handle.Position.X,0,Tool.Handle.Position.Z)local W=Character.Head.Position W=W+K*5 Tool.Handle.Transparency=1 local A=Tool.Handle:Clone()A.Parent=workspace A.Transparency=1 A.Swing.Pitch=math.random(90,110)/100 A.Swing:Play()A.CanCollide=true A.CFrame=Tool.Handle.CFrame A.Velocity=K*AttackVelocity+Vector3.new(0,AttackVelocity/7.5,0)A.Trail.Enabled=true A.Fuse:Play()A.Sparks.Enabled=true local d=11.25 A.RotVelocity=Vector3.new(math.random(-d,d),math.random(-d,d),math.random(-d,d))A:SetNetworkOwner(getPlayer())local T=DamageScript:Clone()T.Parent=A T.Disabled=false local L=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")L.Value=getPlayer()L.Name="\107\105\108\108\101\114"L.Parent=A Tool:Destroy()end script.Parent.Power.OnServerEvent:Connect(function(K,k)AttackVelocity=k end)Remote.OnServerEvent:Connect(function(K,k)if not AttackAble then return end AttackAble=false if Humanoid and Humanoid.RigType==Enum.HumanoidRigType.R15 then Remote:FireClient(getPlayer(),"\080\108\097\121\065\110\105\109\097\116\105\111\110","\065\110\105\109\097\116\105\111\110")end local W=k.p local A=(W-Character.Head.Position).unit Toss(A)LeftDown=true end)function onLeftUp()LeftDown=false end Tool.Equipped:Connect(function()Character=Tool.Parent Humanoid=Character:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")end)Tool.Unequipped:Connect(function()Character=nil Humanoid=nil end)
--returns the wielding player of this tool
function getPlayer()
	local char = Tool.Parent
	return game:GetService("Players"):GetPlayerFromCharacter(Character)
end

function Toss(direction)
	local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
	local spawnPos = Character.Head.Position
	spawnPos = spawnPos + (direction * 5)
	Tool.Handle.Transparency = 1
	local Object = Tool.Handle:Clone()
	Object.Parent = workspace
	Object.Transparency = 1
	Object.Swing.Pitch = math.random(90, 110) / 100
	Object.Swing:Play()
	Object.CanCollide = true
	Object.CFrame = Tool.Handle.CFrame
	Object.Velocity = (direction * AttackVelocity) + Vector3.new(0, AttackVelocity / 7.5, 0)
	Object.Trail.Enabled = true
	Object.Fuse:Play()
	Object.Sparks.Enabled = true
	local rand = 11.25
	Object.RotVelocity = Vector3.new(math.random(-rand, rand), math.random(-rand, rand), math.random(-rand, rand))
	Object:SetNetworkOwner(getPlayer())
	local ScriptClone = DamageScript:Clone()
	ScriptClone.Parent = Object
	ScriptClone.Disabled = false
	local tag = Instance.new("ObjectValue")
	tag.Value = getPlayer()
	tag.Name = "killer"
	tag.Parent = Object
	Tool:Destroy()
end

script.Parent.Power.OnServerEvent:Connect(function(player, Power)
	AttackVelocity = Power
end)

Remote.OnServerEvent:Connect(function(player, mousePosition)
	if not AttackAble then
		return
	end
	AttackAble = false
	if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
		Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
	end
	local targetPos = mousePosition.p
	local lookAt = (targetPos - Character.Head.Position).unit
	Toss(lookAt)
	LeftDown = true
end)

function onLeftUp()
	LeftDown = false
end

Tool.Equipped:Connect(function()
	Character = Tool.Parent
	Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)

Tool.Unequipped:Connect(function()
	Character = nil
	Humanoid = nil
end)
