THROW_MULTIPLIER=.25 local w={}w.MouseButton1=function(w,k)local u=k[1]local X=w:FindFirstChildOfClass("\084\111\111\108")if not X:FindFirstChild("\068\105\115\112\108\097\121")then return end;(w.Humanoid:LoadAnimation(script.Toss)):Play()task.wait(.3)local a=Instance.new("\077\111\100\101\108",workspace.Debris)a.Name=w.Name..("\095"..script.Name)local y=X:Clone()y.Display.Parent=a y.Handle.Parent=a y:Destroy()local l=X.Display l.Parent=ServerStorage.PlayerStorage local U=100*THROW_MULTIPLIER local z=a.Handle local N=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")N.Velocity=(u-z.Position).unit*U+Vector3.new(0,50,0)N.P=math.huge N.Parent=z local I I=z.Touched:Connect(function(k)if k:IsDescendantOf(workspace.Enemies)and k.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then local u=k.Parent local X=w:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")I:Disconnect()Ragdoll.Toggle(u)a:Destroy()local y=ServerStorage.Models.NetDisplay:Clone()y.Parent=workspace.Debris y:MoveTo((u.HumanoidRootPart.CFrame*CFrame.new(0,5,0)).Position)end end)local j=.5 wait(j)N:Destroy()task.wait(5)l.Parent=X end w.Z=function(w)print("\104\097\105 \090")end w.X=function(w)print("\104\097\105 \088")end return w


THROW_MULTIPLIER = 0.25




local Tool = {}

Tool.MouseButton1 = function(Character, ExtraData) -- Throw
	local MousePosition = ExtraData[1]
	local Net = Character:FindFirstChildOfClass("Tool")
	
	if not Net:FindFirstChild("Display") then return end
	
	
	Character.Humanoid:LoadAnimation(script.Toss):Play()
	
	task.wait(0.3)
	
	local Model = Instance.new("Model", workspace.Debris)
	Model.Name = Character.Name.."_"..script.Name
	local CloneNet = Net:Clone()
	CloneNet.Display.Parent = Model
	CloneNet.Handle.Parent = Model
	CloneNet:Destroy()
	
	local Display = Net.Display
	Display.Parent = ServerStorage.PlayerStorage
	
	-- Throw Model.Handle
	local throwForce = 100*THROW_MULTIPLIER -- Adjust this value to change the throwing force

	local Handle = Model.Handle -- Assuming the net's handle is named "Handle"
	local BodyVelocity = Instance.new("BodyVelocity")
	BodyVelocity.Velocity = (MousePosition - Handle.Position).unit * throwForce + Vector3.new(0,50,0)
	BodyVelocity.P = math.huge -- Sets linear damping to zero so the net doesn't slow down over time
	BodyVelocity.Parent = Handle
	
	local Connection
	-- Connect touch function, trip enemy
	Connection = Handle.Touched:Connect(function(hit)
		if hit:IsDescendantOf(workspace.Enemies) and hit.Parent:FindFirstChild("Humanoid") then
			local VictimCharacter = hit.Parent
			local Humanoid = Character:FindFirstChildOfClass("Humanoid")
			
			Connection:Disconnect()
			
			Ragdoll.Toggle(VictimCharacter)
			
			Model:Destroy()
			
			-- Clone ServerStorage.Models.NetDisplay above the enemy to simulate the net falling on top of it, use its handle to cframe it
				-- This will be the visual representation of the net trapping the enemy
			local NetDisplay = ServerStorage.Models.NetDisplay:Clone()
			NetDisplay.Parent = workspace.Debris
			NetDisplay:MoveTo((VictimCharacter.HumanoidRootPart.CFrame * CFrame.new(0,5,0)).Position)
			
			--game.Debris:AddItem(NetDisplay, 10)
			
		end
	end)

	-- Optionally, you can remove the BodyVelocity after a certain amount of time
	local removeDelay = .5 -- Adjust this value to change the delay before removing the BodyVelocity
	wait(removeDelay)
	BodyVelocity:Destroy()
	
	task.wait(5)

	Display.Parent = Net
	
end
Tool.Z = function(Character)
	print("hai Z")
end
Tool.X = function(Character)
	print("hai X")
end	



return Tool
