function getPlayer()local M=Tool.Parent return(game:GetService("\080\108\097\121\101\114\115")):GetPlayerFromCharacter(Character)end function Toss(M)local L=Humanoid.WalkSpeed L=L Humanoid.WalkSpeed=0 local o=Vector3.new(Tool.Handle.Position.X,0,Tool.Handle.Position.Z)local F=Character.Head.Position F=F+M*5 Tool.Handle.Transparency=1 local d=Tool.Handle:Clone()d.Parent=workspace d.Transparency=0 d.Swing.Pitch=math.random(90,110)/100 d.Swing:Play()d.CanCollide=true d.CFrame=Tool.Handle.CFrame d.Velocity=M*AttackVelocity+Vector3.new(0,AttackVelocity/7.5,0)d.Fuse:Play()d.Sparks.Enabled=true local R=11.25 d.RotVelocity=Vector3.new(math.random(-R,R),math.random(-R,R),math.random(-R,R))d:SetNetworkOwner(getPlayer())local U=DamageScript:Clone()U.FriendlyFire.Value=FriendlyFire U.Damage.Value=AttackDamage U.Parent=d U.Disabled=false local N=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")N.Value=getPlayer()N.Name="\099\114\101\097\116\111\114"N.Parent=d Humanoid.WalkSpeed=L Tool:Destroy()end Remote.OnServerEvent:Connect(function(M,L)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 o=L.p local F=(o-Character.Head.Position).unit Toss(F)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)
--returns the wielding player of this tool
function getPlayer()
	local char = Tool.Parent
	return game:GetService("Players"):GetPlayerFromCharacter(Character)
end

function Toss(direction)
	local OriginalWalkSpeed = Humanoid.WalkSpeed
	OriginalWalkSpeed = OriginalWalkSpeed
	Humanoid.WalkSpeed = 0
	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 = 0
	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.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.FriendlyFire.Value = FriendlyFire
	ScriptClone.Damage.Value = AttackDamage
	ScriptClone.Parent = Object
	ScriptClone.Disabled = false
	local tag = Instance.new("ObjectValue")
	tag.Value = getPlayer()
	tag.Name = "creator"
	tag.Parent = Object
	Humanoid.WalkSpeed = OriginalWalkSpeed
	Tool:Destroy()
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)
