comn = script.Parent
plr = game.Players.LocalPlayer
function onButton1Down(mouse)
	if game.Workspace:FindFirstChild(plr.Name.."s"..script.Parent.Name) then	
		game.Workspace[plr.Name.."s"..script.Parent.Name]:remove()	
		local model = game.Lighting.Animals[script.Parent.Name]:clone()										 
		model.Parent = game.Workspace
		model.Name = plr.Name.."s"..script.Parent.Name
		model:MakeJoints()
		model:MoveTo(mouse.hit.p+Vector3.new(0,1,0))
		wait(0.3)
		comn.Unequipped:connect(Unequip)
		script.Parent:remove() -- removes the spawner tool
	else
		local model = game.Lighting.Animals[script.Parent.Name]:clone()										 
		model.Parent = game.Workspace
		model.Name = plr.Name.."s"..script.Parent.Name
		model:MakeJoints()
		model:MoveTo(mouse.hit.p+Vector3.new(0,1,0))
		wait(0.3)
		comn.Unequipped:connect(Unequip)
		script.Parent:remove() -- removes the spawner tool
	end	
end

function onEquippedLocal(mouse)

	if mouse == nil then
		print("Mouse not found")
		return 
	end

	mouse.Icon = ""
	mouse.Button1Down:connect(function() onButton1Down(mouse) end)	
end


comn.Equipped:connect(onEquippedLocal)