local a=nil local f=nil uses=0 local function B()a=Tool.Parent f=PlayersService:GetPlayerFromCharacter(a)end local function l()if not a or not a:FindFirstChild("\072\117\109\097\110\111\105\100")or not Tool.Enabled then return end Tool.Enabled=false uses=uses+1 ThrowSound:Play()local B=ToolHandle:Clone()DebrisService:AddItem(B,30)B.Name="\070\111\111\100"B.Parent=Workspace B.Transparency=0 B.CanCollide=true Instance.new("\066\111\100\121\071\121\114\111",B)local l=B:FindFirstChild("\083\101\108\102\068\101\115\116\114\117\099\116")if l and l:FindFirstChild("\084\105\109\101\084\111\076\105\118\101")then l.TimeToLive.Value=TIME_TO_LIVE l.Disabled=false end local e=B:FindFirstChild("\080\111\105\115\111\110\101\100\070\111\111\100")if e then local a=Instance.new("\079\098\106\101\099\116\086\097\108\117\101",e)a.Name="\067\114\101\097\116\111\114"a.Value=f e.Disabled=false end B.CFrame=(Tool.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")).CFrame if uses>=3 then Tool:Destroy()end wait(COOLDOWN)Tool.Enabled=true end local function e()ToolHandle.Transparency=0 end Tool.Equipped:connect(B)Tool.Activated:connect(l)Tool.Unequipped:connect(e)


local MyModel = nil
local MyPlayer = nil

uses = 0

local function OnEquipped()
	MyModel = Tool.Parent
	MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
end

local function OnActivated()
	if not MyModel or not MyModel:FindFirstChild('Humanoid') or not Tool.Enabled then return end
	Tool.Enabled = false
	
	uses = uses + 1

	ThrowSound:Play()

	local handleClone = ToolHandle:Clone()
	DebrisService:AddItem(handleClone, 30)
	--handleClone.Velocity = (MyModel.Humanoid.TargetPoint - ToolHandle.CFrame.p).unit * THROW_SPEED
	handleClone.Name = 'Food'
	handleClone.Parent = Workspace
	handleClone.Transparency = 0
	handleClone.CanCollide = true
	Instance.new('BodyGyro', handleClone) -- Keeps it upright
	local selfDestructScript = handleClone:FindFirstChild('SelfDestruct')
	if selfDestructScript and selfDestructScript:FindFirstChild('TimeToLive') then
		selfDestructScript.TimeToLive.Value = TIME_TO_LIVE
		selfDestructScript.Disabled = false
	end
	local foodScript = handleClone:FindFirstChild('PoisonedFood')
	if foodScript then
		local creator = Instance.new('ObjectValue', foodScript)
		creator.Name = 'Creator'
		creator.Value = MyPlayer
		foodScript.Disabled = false
	end
	handleClone.CFrame = Tool.Parent:FindFirstChild("HumanoidRootPart").CFrame
	
	if uses >= 3 then
		Tool:Destroy()
	end

	--[[ Load new item (while we wait)
	local index = math.random(3)
	ToolHandle.Mesh.MeshId = BaseIdUrl .. MeshIds[index]
	ToolHandle.Mesh.TextureId = BaseIdUrl .. TextureIds[index]
	ToolHandle.Size = HandleSizes[index] -- This breaks the weld
	MyWeld.Parent = Game.JointsService -- Fix the weld
	Tool.TextureId = BaseIdUrl .. IconIds[index] -- Change the tool icon
	--]]

	wait(COOLDOWN)

	Tool.Enabled = true
	
end

local function OnUnequipped()
	ToolHandle.Transparency = 0
end

Tool.Equipped:connect(OnEquipped)
Tool.Activated:connect(OnActivated)
Tool.Unequipped:connect(OnUnequipped)
