function checkTeams(y)return not(sameTeam(y)and not FriendlyFire)end function getKnife()local y=Handle:clone()y.Transparency=0 y.Hit.Pitch=math.random(90,110)/100 local J=Instance.new("\066\111\100\121\070\111\114\099\101")J.force=(Vector3.new(0,196.2,0)*y:GetMass())*.8 J.Parent=y local K=Tool.Projectile:Clone()K.Disabled=false K.Parent=y return y end function equippedLoop()while Equipped do local y=Heartbeat:wait()if AttackPower<1 then AttackPower=AttackPower+y*AttackRecharge if AttackPower>1 then AttackPower=1 end end Handle.Transparency=1-AttackPower end end function onLeftDown(y)local J=getKnife()J.CFrame=CFrame.new(Handle.Position,y)J.Velocity=(J.CFrame.lookVector*AttackSpeed)*AttackPower local K=AttackDamage*AttackPower local l l=J.Touched:connect(function(y)if y:IsDescendantOf(Tool.Parent)then return end if contains(Knives,y)then return end if y.Parent and y.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then local l=y.Parent.Humanoid if checkTeams(l)then tagHuman(l)l:TakeDamage(K)J.Hit:Play()end end J.Projectile:Destroy()local d=Instance.new("\087\101\108\100")d.Part0=y d.Part1=J d.C0=y.CFrame:toObjectSpace(J.CFrame)d.Parent=d.Part0 l:disconnect()end)table.insert(Knives,J)J.Parent=workspace;(game:GetService("\068\101\098\114\105\115")):AddItem(J,35.5)delay(25,function()J.Transparency=1 end)Remote:FireClient(getPlayer(),"\080\108\097\121\065\110\105\109\097\116\105\111\110","\084\104\114\111\119")Handle.Throw.Pitch=.8+.4*AttackPower Handle.Throw:Play()AttackPower=0 end function onRemote(y,J,...)if y~=getPlayer()then return end if J=="\076\101\102\116\068\111\119\110"then onLeftDown(...)end end function onEquip()Equipped=true equippedLoop()end function onUnequip()Equipped=false end Remote.OnServerEvent:connect(onRemote)Tool.Equipped:connect(onEquip)Tool.Unequipped:connect(onUnequip)
--use this to determine if you want this human to be harmed or not, returns boolean
function checkTeams(otherHuman)
	return not (sameTeam(otherHuman) and not FriendlyFire)
end

function getKnife()
	local knife = Handle:clone()
	knife.Transparency = 0
	knife.Hit.Pitch = math.random(90, 110) / 100

	local lift = Instance.new("BodyForce")
	lift.force = Vector3.new(0, 196.2, 0) * knife:GetMass() * 0.8
	lift.Parent = knife

	local proj = Tool.Projectile:Clone()
	proj.Disabled = false
	proj.Parent = knife

	return knife
end

function equippedLoop()
	while Equipped do
		local dt = Heartbeat:wait()

		if AttackPower < 1 then
			AttackPower = AttackPower + dt * AttackRecharge
			if AttackPower > 1 then
				AttackPower = 1
			end
		end

		Handle.Transparency = 1 - AttackPower
	end
end

function onLeftDown(mousePos)
	local knife = getKnife()
	knife.CFrame = CFrame.new(Handle.Position, mousePos)
	knife.Velocity = knife.CFrame.lookVector * AttackSpeed * AttackPower
	local damage = AttackDamage * AttackPower
	local touched
	touched = knife.Touched:connect(function(part)
		if part:IsDescendantOf(Tool.Parent) then
			return
		end
		if contains(Knives, part) then
			return
		end

		if part.Parent and part.Parent:FindFirstChild("Humanoid") then
			local human = part.Parent.Humanoid
			if checkTeams(human) then
				tagHuman(human)
				human:TakeDamage(damage)
				knife.Hit:Play()
			end
		end

		knife.Projectile:Destroy()

		local w = Instance.new("Weld")
		w.Part0 = part
		w.Part1 = knife
		w.C0 = part.CFrame:toObjectSpace(knife.CFrame)
		w.Parent = w.Part0

		touched:disconnect()
	end)
	table.insert(Knives, knife)
	knife.Parent = workspace

	game:GetService("Debris"):AddItem(knife, 35.5)
	delay(25, function()
		knife.Transparency = 1
	end)

	Remote:FireClient(getPlayer(), "PlayAnimation", "Throw")

	Handle.Throw.Pitch = 0.8 + 0.4 * AttackPower
	Handle.Throw:Play()

	AttackPower = 0
end

function onRemote(player, func, ...)
	if player ~= getPlayer() then
		return
	end

	if func == "LeftDown" then
		onLeftDown(...)
	end
end

function onEquip()
	Equipped = true
	equippedLoop()
end

function onUnequip()
	Equipped = false
end

Remote.OnServerEvent:connect(onRemote)
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
