local Z=math.pi*4.5 local q=game.Players.LocalPlayer local C=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")game.ReplicatedStorage.Interactions.Client.BeginKnifeThrow.OnClientEvent:connect(function(q,A,G)local k=false local u=nil local c=game.ReplicatedStorage.Interactions.Client.EndKnifeThrow.OnClientEvent:connect(function(Z,C)if Z==q then k=true u=C end end)local b=nil while not k do local k=wait()local u=(A*-Z)*k local c={CFrame=(q.CFrame+G*k)*CFrame.fromEulerAnglesXYZ(u.X,u.Y,u.Z)}b=C:Create(q,TweenInfo.new(k,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),c)b:Play()end c:disconnect()if b~=nil then b:Cancel()end if q.Parent~=nil and u~=nil then q.CFrame=u end end)
-- Basic settings
local ROTATION_SPEED = math.pi * 4.5

local plr = game.Players.LocalPlayer
local tweenService = game:GetService("TweenService")

game.ReplicatedStorage.Interactions.Client.BeginKnifeThrow.OnClientEvent:connect(function(knife, rotateAxis, velocity)
	-- Connect end knife throw
	local stopLoop = false
	local finalCFrame = nil
	local endEvent = game.ReplicatedStorage.Interactions.Client.EndKnifeThrow.OnClientEvent:connect(
		function(otherKnife, cframe)
			if otherKnife == knife then
				stopLoop = true
				finalCFrame = cframe
			end
		end
	)

	-- Make knife move smoothly
	local currentTween = nil
	while not stopLoop do
		-- Wait
		local waitTime = wait()

		-- Tween
		local rotateAmt = rotateAxis * -ROTATION_SPEED * waitTime
		local goal = {
			CFrame = (knife.CFrame + (velocity * waitTime))
				* CFrame.fromEulerAnglesXYZ(rotateAmt.X, rotateAmt.Y, rotateAmt.Z),
		}
		currentTween =
			tweenService:Create(knife, TweenInfo.new(waitTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), goal)
		currentTween:Play()
	end

	-- Disconnect event
	endEvent:disconnect()

	-- End tween
	if currentTween ~= nil then
		currentTween:Cancel()
	end

	-- Set final CFrame
	if knife.Parent ~= nil and finalCFrame ~= nil then
		knife.CFrame = finalCFrame
	end
end)
